WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
ActionExecutor.h
1 
10 #ifndef WRENCH_ACTION_EXECUTOR_H
11 #define WRENCH_ACTION_EXECUTOR_H
12 
13 #include <set>
14 
15 #include "wrench/execution_controller/ExecutionController.h"
16 #include "wrench/services/Service.h"
17 #include "wrench/action/Action.h"
18 
19 namespace wrench {
20 
21  class Simulation;
22  class Action;
23  class ActionExecutionService;
24 
25  /***********************/
27  /***********************/
28 
33 
34  public:
35 
37  std::string hostname,
38  unsigned long num_cores,
39  double ram_footprint,
40  simgrid::s4u::Mailbox *callback_mailbox,
41  std::shared_ptr<Action> action,
42  std::shared_ptr<ActionExecutionService> action_execution_service);
43 
44  int main() override;
45  void kill(bool job_termination);
46  void cleanup(bool has_returned_from_main, int return_value) override;
47 
48  std::shared_ptr<Action> getAction();
49  unsigned long getNumCoresAllocated() const;
50  double getMemoryAllocated() const;
51 
52  std::shared_ptr<ActionExecutionService> getActionExecutionService() const;
53 
54  private:
55 
56  std::shared_ptr<Action> action;
57  std::shared_ptr<ActionExecutionService> action_execution_service;
58  simgrid::s4u::Mailbox *callback_mailbox;
59  bool killed_on_purpose;
60 
61  unsigned long num_cores;
62  double ram_footprint;
63 
64  };
65 
66  /***********************/
68  /***********************/
69 
70 };
71 
72 #endif //WRENCH_ACTION_EXECUTOR_H
wrench::ActionExecutor::getNumCoresAllocated
unsigned long getNumCoresAllocated() const
Return the action executor's allocated nuber of cores.
Definition: ActionExecutor.cpp:166
wrench::ExecutionController
An abstraction of an execution controller, i.e., a running process that interacts with other services...
Definition: ExecutionController.h:37
wrench::ActionExecutor::cleanup
void cleanup(bool has_returned_from_main, int return_value) override
Cleanup method that implements the cleanup basics.
Definition: ActionExecutor.cpp:73
wrench::ActionExecutor::getActionExecutionService
std::shared_ptr< ActionExecutionService > getActionExecutionService() const
Get the action execution service that started this action executor (or nullptr if stand-alone action ...
Definition: ActionExecutor.cpp:174
wrench
Definition: Action.cpp:28
wrench::ActionExecutor::main
int main() override
Main method of the action executor.
Definition: ActionExecutor.cpp:103
wrench::ActionExecutor::ActionExecutor
ActionExecutor(std::string hostname, unsigned long num_cores, double ram_footprint, simgrid::s4u::Mailbox *callback_mailbox, std::shared_ptr< Action > action, std::shared_ptr< ActionExecutionService > action_execution_service)
Constructor.
Definition: ActionExecutor.cpp:35
wrench::ActionExecutor::getAction
std::shared_ptr< Action > getAction()
Returns the executor's action.
Definition: ActionExecutor.cpp:64
wrench::S4U_Daemon::hostname
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:60
wrench::ActionExecutor::kill
void kill(bool job_termination)
Kill the worker thread.
Definition: ActionExecutor.cpp:143
wrench::ActionExecutor
An service that performs an Action.
Definition: ActionExecutor.h:32
wrench::ActionExecutor::getMemoryAllocated
double getMemoryAllocated() const
Return the action executor's allocated RAM.
Definition: ActionExecutor.cpp:158