WRENCH
1.11
Cyberinfrastructure Simulation Workbench
|
Overview | Installation | Getting Started | WRENCH 101 | WRENCH 102 |
An abstract class that implements the concept of an action. More...
#include <Action.h>
Classes | |
struct | ActionExecution |
A data structure that keeps track of an action's execution(s) More... | |
Public Types | |
enum | State { NOT_READY, READY, STARTED, COMPLETED, KILLED, FAILED } |
Action states. More... | |
Public Member Functions | |
std::set< std::shared_ptr< Action > > | getChildren () |
Get the action's children. More... | |
double | getEndDate () const |
Returns this action's end date (-1.0 if not ended) More... | |
std::stack< Action::ActionExecution > & | getExecutionHistory () |
Retrieve the execution history. More... | |
std::shared_ptr< FailureCause > | getFailureCause () const |
Returns the action's failure cause. More... | |
std::shared_ptr< CompoundJob > | getJob () const |
Returns the job this action belongs to. More... | |
virtual unsigned long | getMaxNumCores () const |
Get the maximum number of cores that can be used to execute the action. More... | |
virtual unsigned long | getMinNumCores () const |
Get the minimum number of cores required to execute the action. More... | |
virtual double | getMinRAMFootprint () const |
Get the minimum required amount of RAM to execute the action. More... | |
const std::string & | getName () const |
Returns the action's name. More... | |
std::set< std::shared_ptr< Action > > | getParents () |
Get the action's parents. More... | |
double | getPriority () const |
Get the action's priority. More... | |
std::shared_ptr< Action > | getSharedPtr () |
Get the shared pointer for this object. More... | |
double | getStartDate () const |
Returns ths action's started date (-1.0 if not started) More... | |
Action::State | getState () const |
Returns the action's state. More... | |
std::string | getStateAsString () const |
Returns the action's state as a human-readable string. More... | |
void | setPriority (double priority) |
Set the action's priority. More... | |
void | setSimulateComputationAsSleep (bool simulate_computation_as_sleep) |
Set whether simulation should be simulated as sleep (default = false) More... | |
void | setThreadCreationOverhead (double overhead_in_seconds) |
Set the thread creation overhead (default = zero) More... | |
virtual bool | usesScratch () const |
Determine whether the action uses scratch. More... | |
Static Public Member Functions | |
static std::string | getActionTypeAsString (const std::shared_ptr< Action > &action) |
Returns an action's type as a human-readable string. More... | |
static std::string | stateToString (Action::State state) |
Convert an action state to a human-readable string. More... | |
Protected Member Functions | |
Action (const std::string &name, const std::string &prefix, std::shared_ptr< CompoundJob > job) | |
Constructor. More... | |
virtual void | execute (std::shared_ptr< ActionExecutor > action_executor)=0 |
Method to execute the task. More... | |
void | newExecution (Action::State state) |
Create a new execution data structure (e.g., after a restart) More... | |
void | setEndDate (double date) |
Sets the action's end date. More... | |
void | setExecutionHost (std::string host) |
Sets the action's execution hosts (and the action's physical execution host) More... | |
void | setFailureCause (std::shared_ptr< FailureCause > failure_cause) |
Sets the action's failure cause. More... | |
void | setNumCoresAllocated (unsigned long num_cores) |
Sets the action's allocated number of cores. More... | |
void | setRAMAllocated (double ram) |
Sets the action's allocated RAM. More... | |
void | setStartDate (double date) |
Sets the action's start date. More... | |
void | setState (Action::State new_state) |
Sets the action's state to a new value. More... | |
virtual void | terminate (std::shared_ptr< ActionExecutor > action_executor)=0 |
Method called when the task terminates. More... | |
void | updateState () |
Update the action's state. | |
Protected Attributes | |
bool | simulate_computation_as_sleep |
Whether to simulate the computation as sleep. | |
double | thread_creation_overhead |
The thread creation overhead in seconds. | |
An abstract class that implements the concept of an action.
Action states.
|
protected |
Constructor.
name | the action's name (if empty, a unique name will be picked) |
prefix | the action's name prefix (if name is empty) |
job | the job that contains this action |
|
protectedpure virtual |
Method to execute the task.
action_executor | the executor that executes this action |
Implemented in wrench::FileRegistryAction, wrench::ComputeAction, wrench::FileCopyAction, wrench::FileReadAction, wrench::CustomAction, wrench::FileDeleteAction, wrench::FileWriteAction, and wrench::SleepAction.
|
static |
Returns an action's type as a human-readable string.
action | the action |
std::set< std::shared_ptr< Action > > wrench::Action::getChildren | ( | ) |
Get the action's children.
double wrench::Action::getEndDate | ( | ) | const |
Returns this action's end date (-1.0 if not ended)
std::stack< Action::ActionExecution > & wrench::Action::getExecutionHistory | ( | ) |
Retrieve the execution history.
std::shared_ptr< FailureCause > wrench::Action::getFailureCause | ( | ) | const |
Returns the action's failure cause.
std::shared_ptr< CompoundJob > wrench::Action::getJob | ( | ) | const |
Returns the job this action belongs to.
|
virtual |
Get the maximum number of cores that can be used to execute the action.
Reimplemented in wrench::CustomAction, and wrench::ComputeAction.
|
virtual |
Get the minimum number of cores required to execute the action.
Reimplemented in wrench::CustomAction, and wrench::ComputeAction.
|
virtual |
Get the minimum required amount of RAM to execute the action.
Reimplemented in wrench::CustomAction, and wrench::ComputeAction.
const std::string & wrench::Action::getName | ( | ) | const |
Returns the action's name.
std::set< std::shared_ptr< Action > > wrench::Action::getParents | ( | ) |
Get the action's parents.
double wrench::Action::getPriority | ( | ) | const |
Get the action's priority.
|
inline |
Get the shared pointer for this object.
double wrench::Action::getStartDate | ( | ) | const |
Returns ths action's started date (-1.0 if not started)
Action::State wrench::Action::getState | ( | ) | const |
Returns the action's state.
std::string wrench::Action::getStateAsString | ( | ) | const |
Returns the action's state as a human-readable string.
|
protected |
Create a new execution data structure (e.g., after a restart)
state | the action state |
|
protected |
Sets the action's end date.
date | the date |
|
protected |
Sets the action's execution hosts (and the action's physical execution host)
host | a hostname |
|
protected |
Sets the action's failure cause.
failure_cause | the failure cause |
|
protected |
Sets the action's allocated number of cores.
num_cores | a number of cores |
void wrench::Action::setPriority | ( | double | priority | ) |
Set the action's priority.
priority | a priority |
|
protected |
Sets the action's allocated RAM.
ram | a number of bytes |
void wrench::Action::setSimulateComputationAsSleep | ( | bool | simulate_computation_as_sleep | ) |
Set whether simulation should be simulated as sleep (default = false)
simulate_computation_as_sleep | true or false |
|
protected |
Sets the action's start date.
date | the date |
|
protected |
Sets the action's state to a new value.
new_state | the new state |
void wrench::Action::setThreadCreationOverhead | ( | double | overhead_in_seconds | ) |
Set the thread creation overhead (default = zero)
overhead_in_seconds | overhead in seconds |
|
static |
Convert an action state to a human-readable string.
state | an action state |
|
protectedpure virtual |
Method called when the task terminates.
action_executor | the executor that executes this action |
Implemented in wrench::FileRegistryAction, wrench::ComputeAction, wrench::FileCopyAction, wrench::FileReadAction, wrench::CustomAction, wrench::FileDeleteAction, wrench::FileWriteAction, and wrench::SleepAction.
|
virtual |
Determine whether the action uses scratch.
Reimplemented in wrench::FileCopyAction, wrench::FileReadAction, wrench::FileDeleteAction, and wrench::FileWriteAction.