Executor Class Reference

Starts, stops and restarts applications and scenarios. Can also be used to request the status of an application. The proper system-specific stopstrategy and starter have to be set in the constructor. More...

#include <ArmarXCore/util/ScenarioManagerCommon/executor/Executor.h>

Public Member Functions

std::future< void > deployApplication (Data_Structure::ApplicationInstancePtr application, bool printOnly=false, const std::string &commandLineParameters="")
 
std::future< void > deployScenario (Data_Structure::ScenarioPtr scenario, bool printOnly=false, const std::string &commandLineParameters="")
 
 Executor (StopStrategyPtr strategy, ApplicationStarterPtr starter)
 Constructor that sets StopStrategy and ApplicationStarter. More...
 
std::string getApplicationStatus (Data_Structure::ApplicationInstancePtr application)
 Returns the status of an application. More...
 
StopStrategyPtr getDefaultStopStrategy ()
 
ApplicationStarterPtr getStarter (Data_Structure::ScenarioPtr scenario)
 
StopStrategyPtr getStopStrategy (Data_Structure::ScenarioPtr scenario)
 
bool isApplicationDeployed (Data_Structure::ApplicationInstancePtr application)
 
bool isScenarioDeployed (Data_Structure::ScenarioPtr scenario)
 
void loadAndSetCachedProperties (Data_Structure::ApplicationPtr application, std::string path, bool reload=false, bool set=true)
 Generates an XML file of the given application and saves it in the specified path. More...
 
std::future< void > removeApplication (Data_Structure::ApplicationInstancePtr application)
 
std::future< void > removeScenario (Data_Structure::ScenarioPtr scenario)
 
std::future< void > restartApplication (Data_Structure::ApplicationInstancePtr application, bool printOnly=false)
 Restarts an application. More...
 
std::future< void > restartScenario (Data_Structure::ScenarioPtr scenario, bool printOnly=false)
 Restarts a scenario. More...
 
void setDefaultStarter (ApplicationStarterPtr starter)
 Sets the starter this Executor uses to start applications and request statuses. More...
 
void setDefaultStopStrategy (StopStrategyPtr strategy)
 Sets the strategy this Executor uses to stop applications. More...
 
void setStarter (ApplicationStarterPtr starter, Data_Structure::ScenarioPtr scenario)
 
void setStopStrategy (StopStrategyPtr strategy, Data_Structure::ScenarioPtr scenario)
 
std::future< void > startApplication (Data_Structure::ApplicationInstancePtr application, bool printOnly=false, const std::string &commandLineParameters="")
 Starts an application. More...
 
std::future< void > startScenario (Data_Structure::ScenarioPtr scenario, bool printOnly=false, const std::string &commandLineParameters="")
 Starts a scenario. More...
 
std::future< void > stopApplication (Data_Structure::ApplicationInstancePtr application)
 Stops an application. More...
 
std::future< void > stopScenario (Data_Structure::ScenarioPtr scenario)
 Stops a scenario. More...
 

Detailed Description

Starts, stops and restarts applications and scenarios. Can also be used to request the status of an application. The proper system-specific stopstrategy and starter have to be set in the constructor.

Definition at line 54 of file Executor.h.

Constructor & Destructor Documentation

◆ Executor()

Constructor that sets StopStrategy and ApplicationStarter.

Parameters
strategyStrategy used to stop applications.
starterStarter used to start applications and request their status.

Definition at line 40 of file Executor.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ deployApplication()

std::future< void > deployApplication ( Data_Structure::ApplicationInstancePtr  application,
bool  printOnly = false,
const std::string &  commandLineParameters = "" 
)

Definition at line 69 of file Executor.cpp.

+ Here is the call graph for this function:

◆ deployScenario()

std::future< void > deployScenario ( Data_Structure::ScenarioPtr  scenario,
bool  printOnly = false,
const std::string &  commandLineParameters = "" 
)

Definition at line 192 of file Executor.cpp.

+ Here is the call graph for this function:

◆ getApplicationStatus()

std::string getApplicationStatus ( Data_Structure::ApplicationInstancePtr  application)

Returns the status of an application.

Uses the ApplicationStarter to request the status, therefore the proper system-specific starter has to be set, even to use this method.

Parameters
applicationapplication whose status is returned
Returns
status of the application

Definition at line 160 of file Executor.cpp.

◆ getDefaultStopStrategy()

Exec::StopStrategyPtr getDefaultStopStrategy ( )

Definition at line 367 of file Executor.cpp.

◆ getStarter()

Definition at line 339 of file Executor.cpp.

◆ getStopStrategy()

Exec::StopStrategyPtr getStopStrategy ( Data_Structure::ScenarioPtr  scenario)

Definition at line 348 of file Executor.cpp.

◆ isApplicationDeployed()

bool isApplicationDeployed ( Data_Structure::ApplicationInstancePtr  application)

Definition at line 357 of file Executor.cpp.

◆ isScenarioDeployed()

bool isScenarioDeployed ( Data_Structure::ScenarioPtr  scenario)

Definition at line 362 of file Executor.cpp.

◆ loadAndSetCachedProperties()

void loadAndSetCachedProperties ( Data_Structure::ApplicationPtr  application,
std::string  path,
bool  reload = false,
bool  set = true 
)

Generates an XML file of the given application and saves it in the specified path.

If there already is an XML file at that location it only reloads the file if the executable is more recently changed than the Xml file

Parameters
applicationApplication whose XML file is to be generate
pathlocation to save the XML, must be a folder
reloadforces to reload the cached XML
setif true the newly Cached Xml gets loaded into the Application (Warning: If you load an ApplicationInstance the cfg parameter have to be reloaded)

Definition at line 279 of file Executor.cpp.

+ Here is the call graph for this function:

◆ removeApplication()

std::future< void > removeApplication ( Data_Structure::ApplicationInstancePtr  application)

Definition at line 103 of file Executor.cpp.

+ Here is the call graph for this function:

◆ removeScenario()

std::future< void > removeScenario ( Data_Structure::ScenarioPtr  scenario)

Definition at line 241 of file Executor.cpp.

+ Here is the call graph for this function:

◆ restartApplication()

std::future< void > restartApplication ( Data_Structure::ApplicationInstancePtr  application,
bool  printOnly = false 
)

Restarts an application.

Stops and starts an application.

Parameters
applicationapplication to be restarted
Returns
true
if the application was successfully restarted. Successfull restart requires successfull stop and successfull start. An already stopped application also counts as successfully restarted, if successfully started.

Definition at line 143 of file Executor.cpp.

◆ restartScenario()

std::future< void > restartScenario ( Data_Structure::ScenarioPtr  scenario,
bool  printOnly = false 
)

Restarts a scenario.

Iterates over the applications in the scenario and restarts them.

Parameters
scenarioscenario to be restarted
Returns
true
if all applications were successfully restarted

Definition at line 270 of file Executor.cpp.

◆ setDefaultStarter()

void setDefaultStarter ( ApplicationStarterPtr  starter)

Sets the starter this Executor uses to start applications and request statuses.

Needs to be system specific. Use the Factory-Classes to get the proper starter for your system.

Parameters
starterstarter to be set
See also
StarterFactory
StarterFactoryLinux

Definition at line 324 of file Executor.cpp.

+ Here is the caller graph for this function:

◆ setDefaultStopStrategy()

void setDefaultStopStrategy ( StopStrategyPtr  strategy)

Sets the strategy this Executor uses to stop applications.

Needs to be system specific. Use the Factory-Classes to get the proper strategy for your system.

Parameters
strategystrategy to be set
See also
StopStrategyFactory

Definition at line 320 of file Executor.cpp.

+ Here is the caller graph for this function:

◆ setStarter()

void setStarter ( ApplicationStarterPtr  starter,
Data_Structure::ScenarioPtr  scenario 
)

Definition at line 334 of file Executor.cpp.

◆ setStopStrategy()

void setStopStrategy ( StopStrategyPtr  strategy,
Data_Structure::ScenarioPtr  scenario 
)

Definition at line 329 of file Executor.cpp.

◆ startApplication()

std::future< void > startApplication ( Data_Structure::ApplicationInstancePtr  application,
bool  printOnly = false,
const std::string &  commandLineParameters = "" 
)

Starts an application.

Parameters
applicationapplication to be started.
Returns
true
if the application was successfully started

Definition at line 46 of file Executor.cpp.

+ Here is the call graph for this function:

◆ startScenario()

std::future< void > startScenario ( Data_Structure::ScenarioPtr  scenario,
bool  printOnly = false,
const std::string &  commandLineParameters = "" 
)

Starts a scenario.

Iterates over the applications in the scenario and starts them.

Parameters
scenarioscenario to be started
Returns
true
if all applications were successfully started

Definition at line 169 of file Executor.cpp.

+ Here is the call graph for this function:

◆ stopApplication()

std::future< void > stopApplication ( Data_Structure::ApplicationInstancePtr  application)

Stops an application.

Parameters
applicationapplication to be stopped
Returns
true
if the application was successfully stopped

Definition at line 88 of file Executor.cpp.

+ Here is the call graph for this function:

◆ stopScenario()

std::future< void > stopScenario ( Data_Structure::ScenarioPtr  scenario)

Stops a scenario.

Iterates over the applications in the scenario and stops them.

Parameters
scenarioscenario to be stopped
Returns
true
if all applications were successfully stopped

Definition at line 232 of file Executor.cpp.


The documentation for this class was generated from the following files: