WRENCH
1.11
Cyberinfrastructure Simulation Workbench
|
Overview | Installation | Getting Started | WRENCH 101 | WRENCH 102 |
A compound job. More...
#include <CompoundJob.h>
Public Types | |
enum | State { NOT_SUBMITTED, SUBMITTED, COMPLETED, DISCONTINUED } |
Compound job states. More... | |
Public Member Functions | |
void | addActionDependency (const std::shared_ptr< Action > &parent, const std::shared_ptr< Action > &child) |
Add a dependency between two actions (does nothing if dependency already exists) More... | |
void | addChildJob (const std::shared_ptr< CompoundJob > &child) |
Add a child job to this job (be careful not to add circular dependencies, which may lead to deadlocks) More... | |
std::shared_ptr< ComputeAction > | addComputeAction (std::string name, double flops, double ram, unsigned long min_num_cores, unsigned long max_num_cores, std::shared_ptr< ParallelModel > parallel_model) |
Add a compute action to the job. More... | |
std::shared_ptr< CustomAction > | addCustomAction (std::string name, double ram, unsigned long num_cores, const std::function< void(std::shared_ptr< ActionExecutor > action_executor)> &lambda_execute, const std::function< void(std::shared_ptr< ActionExecutor > action_executor)> &lambda_terminate) |
Add a custom action to the job. More... | |
std::shared_ptr< FileCopyAction > | addFileCopyAction (std::string name, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src_file_location, std::shared_ptr< FileLocation > dst_file_location) |
Add a file copy action to the job. More... | |
std::shared_ptr< FileDeleteAction > | addFileDeleteAction (std::string name, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > file_location) |
Add a file delete action to the job. More... | |
std::shared_ptr< FileReadAction > | addFileReadAction (std::string name, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > file_location) |
Add a file read action to the job. More... | |
std::shared_ptr< FileReadAction > | addFileReadAction (std::string name, std::shared_ptr< DataFile >file, std::vector< std::shared_ptr< FileLocation >> file_locations) |
Add a file read action to the job. More... | |
std::shared_ptr< FileRegistryAddEntryAction > | addFileRegistryAddEntryAction (std::shared_ptr< FileRegistryService > file_registry, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > file_location) |
Add a file registry add entry action. More... | |
std::shared_ptr< FileRegistryDeleteEntryAction > | addFileRegistryDeleteEntryAction (std::shared_ptr< FileRegistryService > file_registry, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > file_location) |
Add a file registry add entry action. More... | |
std::shared_ptr< FileWriteAction > | addFileWriteAction (std::string name, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > file_location) |
Add a file write action to the job. More... | |
void | addParentJob (const std::shared_ptr< CompoundJob > &parent) |
Add a parent job to this job (be careful not to add circular dependencies, which may lead to deadlocks) More... | |
std::shared_ptr< SleepAction > | addSleepAction (std::string name, double sleep_time) |
Add a sleep action to the job. More... | |
std::set< std::shared_ptr< Action > > | getActions () |
Get the job's actions. More... | |
std::set< std::shared_ptr< CompoundJob > > | getChildrenJobs () |
Get the job's children. More... | |
double | getMinimumRequiredMemory () |
Get the minimum required amount of memory to run the job. More... | |
unsigned long | getMinimumRequiredNumCores () |
Get the minimum required num cores to run the job. More... | |
std::set< std::shared_ptr< CompoundJob > > | getParentJobs () |
Get the job's parents. More... | |
std::shared_ptr< CompoundJob > | getSharedPtr () |
Get the shared pointer for this object. More... | |
CompoundJob::State | getState () |
Get the state of the standard job. More... | |
std::string | getStateAsString () |
Get the state of the standard job. More... | |
bool | hasFailed () |
Return whether the job has terminated and has done so with some tasks having failed. More... | |
bool | hasSuccessfullyCompleted () |
Return whether the job has terminated and has done so successfully. More... | |
void | printActionDependencies () |
Print the list of actions with their children and parents. | |
void | printTaskMap () |
Print the task map. | |
void | removeAction (std::shared_ptr< Action > &action) |
Remove an action from the job. More... | |
void | setPriority (double priority) override |
Set the job's priority (the higher the priority value, the higher the priority) More... | |
bool | usesScratch () |
Determine whether the job uses scratch. More... | |
Public Member Functions inherited from wrench::Job | |
virtual | ~Job () |
Destructor. | |
simgrid::s4u::Mailbox * | getCallbackMailbox () |
Get the job's "next" callback mailbox, without popping it. More... | |
double | getEndDate () |
Get the date at which the job ended (<0 means "never submitted") More... | |
std::string | getName () |
Get the job's name. More... | |
simgrid::s4u::Mailbox * | getOriginCallbackMailbox () |
Get the "origin" callback mailbox. More... | |
std::shared_ptr< ComputeService > | getParentComputeService () |
Get the compute service that is running /ran the job. More... | |
double | getPriority () const |
Get the job's priority (the higher the priority value, the higher the priority) More... | |
std::map< std::string, std::string > & | getServiceSpecificArguments () |
Return the service-specific arguments that are used during job submission. More... | |
double | getSubmitDate () |
Get the date at which the job was last submitted (<0 means "never submitted") More... | |
simgrid::s4u::Mailbox * | popCallbackMailbox () |
Get the "next" callback mailbox (returns the workflow mailbox if the mailbox stack is empty), and pops it. More... | |
void | printCallbackMailboxStack () |
Method to print the call back stack. | |
void | pushCallbackMailbox (simgrid::s4u::Mailbox *mailbox) |
Pushes a callback mailbox. More... | |
void | setParentComputeService (std::shared_ptr< ComputeService > compute_service) |
Set the parent compute service of the job. More... | |
Protected Member Functions | |
CompoundJob (std::string name, std::shared_ptr< JobManager > job_manager) | |
Constructor. More... | |
std::set< std::shared_ptr< CompoundJob > > & | getChildren () |
Returns the job's child jobs, if any. More... | |
std::set< std::shared_ptr< CompoundJob > > & | getParents () |
Returns the job's parent jobs, if any. More... | |
bool | hasAction (const std::string &name) |
Determine whether an action with a given name exists in job. More... | |
bool | isReady () |
Get the readiness of the job. More... | |
void | setAllActionsFailed (const std::shared_ptr< FailureCause > &cause) |
Set all actions to FAILED for the same failure cause (e.g., a job-level failure) More... | |
void | updateStateActionMap (const std::shared_ptr< Action > &action, Action::State old_state, Action::State new_state) |
Update the internal State-Action map. More... | |
Protected Member Functions inherited from wrench::Job | |
Job (std::string name, std::shared_ptr< JobManager > job_manager) | |
Constructor. More... | |
unsigned long | getNewUniqueNumber () |
Generate a unique number (for each newly generated job) More... | |
void | setServiceSpecificArguments (std::map< std::string, std::string > args) |
Sets the service-specific arguments that are used during job submission. More... | |
Protected Attributes | |
std::set< std::shared_ptr< Action > > | actions |
std::map< std::string, std::shared_ptr< Action > > | name_map |
double | priority |
State | state |
Protected Attributes inherited from wrench::Job | |
bool | already_submitted_to_job_manager = false |
Whether the job has already been submitted to the job manager. | |
std::stack< simgrid::s4u::Mailbox * > | callback_mailbox_stack |
Stack of callback mailboxes (to pop notifications) | |
double | end_date |
The date at which the job ended (with success or failure) | |
std::shared_ptr< JobManager > | job_manager |
The Job Manager in charge of this job. | |
std::string | name |
The job's name. | |
simgrid::s4u::Mailbox * | originator_mailbox |
The originator's mailbox. | |
std::shared_ptr< ComputeService > | parent_compute_service |
The compute service to which the job was submitted. | |
double | priority = 0.0 |
The job's priority (the higher the number, the higher the priority) | |
std::map< std::string, std::string > | service_specific_args |
Service-specific arguments used during job submission. | |
double | submit_date |
The date at which the job was last submitted. | |
A compound job.
Compound job states.
Enumerator | |
---|---|
NOT_SUBMITTED | Job hasn't been submitted yet. |
SUBMITTED | Job has been submitted to a JobManager. |
COMPLETED | Job has finished executing and all actions were successfully completed. |
DISCONTINUED | Job has finished executing but not all actions were successfully completed. Actions may have failed, the job may have been terminated/killed, or parent jobs may have been discontinued. |
|
protected |
Constructor.
name | the job's name (if empty, a unique name will be chosen for you) |
job_manager | the Job Manager in charge of this job |
std::invalid_argument |
void wrench::CompoundJob::addActionDependency | ( | const std::shared_ptr< Action > & | parent, |
const std::shared_ptr< Action > & | child | ||
) |
Add a dependency between two actions (does nothing if dependency already exists)
parent | the parent action |
child | the child action |
void wrench::CompoundJob::addChildJob | ( | const std::shared_ptr< CompoundJob > & | child | ) |
Add a child job to this job (be careful not to add circular dependencies, which may lead to deadlocks)
child | the child job |
std::shared_ptr< ComputeAction > wrench::CompoundJob::addComputeAction | ( | std::string | name, |
double | flops, | ||
double | ram, | ||
unsigned long | min_num_cores, | ||
unsigned long | max_num_cores, | ||
std::shared_ptr< ParallelModel > | parallel_model | ||
) |
Add a compute action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
flops | the number of flops to perform |
ram | the amount of RAM required |
min_num_cores | the minimum number of cores needed |
max_num_cores | the maximum number of cores allowed |
parallel_model | the parallel speedup model |
std::shared_ptr< CustomAction > wrench::CompoundJob::addCustomAction | ( | std::string | name, |
double | ram, | ||
unsigned long | num_cores, | ||
const std::function< void(std::shared_ptr< ActionExecutor > action_executor)> & | lambda_execute, | ||
const std::function< void(std::shared_ptr< ActionExecutor > action_executor)> & | lambda_terminate | ||
) |
Add a custom action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
lambda_execute | the action execution function |
lambda_terminate | the action termination function |
std::shared_ptr< FileCopyAction > wrench::CompoundJob::addFileCopyAction | ( | std::string | name, |
std::shared_ptr< DataFile > | file, | ||
std::shared_ptr< FileLocation > | src_file_location, | ||
std::shared_ptr< FileLocation > | dst_file_location | ||
) |
Add a file copy action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
file | the file |
src_file_location | the file's location where it should be read |
dst_file_location | the file's location where it should be written |
std::shared_ptr< FileDeleteAction > wrench::CompoundJob::addFileDeleteAction | ( | std::string | name, |
std::shared_ptr< DataFile > | file, | ||
std::shared_ptr< FileLocation > | file_location | ||
) |
Add a file delete action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
file | the file |
file_location | the location from which to delete the file |
std::shared_ptr< FileReadAction > wrench::CompoundJob::addFileReadAction | ( | std::string | name, |
std::shared_ptr< DataFile > | file, | ||
std::shared_ptr< FileLocation > | file_location | ||
) |
Add a file read action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
file | the file |
file_location | the file's location |
std::shared_ptr< FileReadAction > wrench::CompoundJob::addFileReadAction | ( | std::string | name, |
std::shared_ptr< DataFile > | file, | ||
std::vector< std::shared_ptr< FileLocation >> | file_locations | ||
) |
Add a file read action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
file | the file |
file_locations | the locations to read the file from (will be tried in order until one succeeds) |
std::shared_ptr< FileRegistryAddEntryAction > wrench::CompoundJob::addFileRegistryAddEntryAction | ( | std::shared_ptr< FileRegistryService > | file_registry, |
std::shared_ptr< DataFile > | file, | ||
std::shared_ptr< FileLocation > | file_location | ||
) |
Add a file registry add entry action.
file_registry | the file registry |
file | the file |
file_location | the file location |
std::shared_ptr< FileRegistryDeleteEntryAction > wrench::CompoundJob::addFileRegistryDeleteEntryAction | ( | std::shared_ptr< FileRegistryService > | file_registry, |
std::shared_ptr< DataFile > | file, | ||
std::shared_ptr< FileLocation > | file_location | ||
) |
Add a file registry add entry action.
file_registry | the file registry |
file | the file |
file_location | the file location |
std::shared_ptr< FileWriteAction > wrench::CompoundJob::addFileWriteAction | ( | std::string | name, |
std::shared_ptr< DataFile > | file, | ||
std::shared_ptr< FileLocation > | file_location | ||
) |
Add a file write action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
file | the file |
file_location | the file's location where it should be written |
void wrench::CompoundJob::addParentJob | ( | const std::shared_ptr< CompoundJob > & | parent | ) |
Add a parent job to this job (be careful not to add circular dependencies, which may lead to deadlocks)
parent | the parent job |
std::shared_ptr< SleepAction > wrench::CompoundJob::addSleepAction | ( | std::string | name, |
double | sleep_time | ||
) |
Add a sleep action to the job.
name | the action's name (if empty, a unique name will be picked for you) |
sleep_time | the time to sleep, in seconds |
std::set< std::shared_ptr< Action > > wrench::CompoundJob::getActions | ( | ) |
Get the job's actions.
|
protected |
Returns the job's child jobs, if any.
std::set< std::shared_ptr< CompoundJob > > wrench::CompoundJob::getChildrenJobs | ( | ) |
Get the job's children.
double wrench::CompoundJob::getMinimumRequiredMemory | ( | ) |
Get the minimum required amount of memory to run the job.
unsigned long wrench::CompoundJob::getMinimumRequiredNumCores | ( | ) |
Get the minimum required num cores to run the job.
std::set< std::shared_ptr< CompoundJob > > wrench::CompoundJob::getParentJobs | ( | ) |
Get the job's parents.
|
protected |
Returns the job's parent jobs, if any.
|
inline |
Get the shared pointer for this object.
CompoundJob::State wrench::CompoundJob::getState | ( | ) |
Get the state of the standard job.
std::string wrench::CompoundJob::getStateAsString | ( | ) |
Get the state of the standard job.
|
protected |
Determine whether an action with a given name exists in job.
name | action name |
bool wrench::CompoundJob::hasFailed | ( | ) |
Return whether the job has terminated and has done so with some tasks having failed.
bool wrench::CompoundJob::hasSuccessfullyCompleted | ( | ) |
Return whether the job has terminated and has done so successfully.
|
protected |
Get the readiness of the job.
void wrench::CompoundJob::removeAction | ( | std::shared_ptr< Action > & | action | ) |
Remove an action from the job.
action | the action to remove |
|
protected |
Set all actions to FAILED for the same failure cause (e.g., a job-level failure)
cause | a failure cause |
|
overridevirtual |
Set the job's priority (the higher the priority value, the higher the priority)
priority | a priority |
Reimplemented from wrench::Job.
|
protected |
Update the internal State-Action map.
action | the action |
old_state | the action's old state |
new_state | the action's new state |
bool wrench::CompoundJob::usesScratch | ( | ) |
Determine whether the job uses scratch.