wrench::CompoundJob

class CompoundJob : public wrench::Job, public std::enable_shared_from_this<CompoundJob>

A compound job class.

Public Types

enum State

Compound job states.

Values:

enumerator NOT_SUBMITTED

Job hasn’t been submitted yet.

enumerator SUBMITTED

Job has been submitted to a JobManager.

enumerator COMPLETED

Job has finished executing and all actions were successfully completed.

enumerator 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.

Public 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)

Parameters:
  • parent – the parent action

  • child – the child action

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)

Parameters:

child – the child job

std::shared_ptr<ComputeAction> addComputeAction(const std::string &name, double flops, double ram, unsigned long min_num_cores, unsigned long max_num_cores, const std::shared_ptr<ParallelModel> &parallel_model)

Add a compute action to the job.

Parameters:
  • 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

Returns:

a compute action

std::shared_ptr<CustomAction> addCustomAction(std::shared_ptr<CustomAction> custom_action)

Add a custom action to the job.

Parameters:

custom_action – a custom action

Returns:

the custom action that was passed in

std::shared_ptr<FileCopyAction> addFileCopyAction(const std::string &name, const std::shared_ptr<DataFile> &file, const std::shared_ptr<StorageService> &src_storageService, const std::shared_ptr<StorageService> &dest_storageService)

Add a file copy action to a job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file – the file to copy

  • src_storage_service – the source storage service

  • dst_storage_service – the destination storage service

Returns:

a file copy action

std::shared_ptr<FileCopyAction> addFileCopyAction(const std::string &name, const std::shared_ptr<FileLocation> &src_file_location, const std::shared_ptr<FileLocation> &dst_file_location)

Add a file copy action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • src_file_location – the file’s location where it should be read

  • dst_file_location – the file’s location where it should be written

Returns:

a file copy action

std::shared_ptr<FileDeleteAction> addFileDeleteAction(const std::string &name, const std::shared_ptr<DataFile> &file, const std::shared_ptr<StorageService> &storageService)

Add a file delete action to a job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file – the file to delete

  • storage_service – the storage service on which the file is

Returns:

a file delete action

std::shared_ptr<FileDeleteAction> addFileDeleteAction(const std::string &name, const std::shared_ptr<FileLocation> &file_location)

Add a file delete action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file_location – the location from which to delete the file

Returns:

a file delete action

std::shared_ptr<FileReadAction> addFileReadAction(const std::string &name, const std::shared_ptr<DataFile> &file, const std::shared_ptr<StorageService> &storageService)

Add a file read action to a job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file – the file to read

  • storage_service – the storage service to read the file from

Returns:

a file read action

std::shared_ptr<FileReadAction> addFileReadAction(const std::string &name, const std::shared_ptr<DataFile> &file, const std::shared_ptr<StorageService> &storageService, double num_bytes_to_read)

Add a file read action to a job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file – the file to read

  • storage_service – the storage service to read the file from

  • num_bytes_to_read – the number of bytes to read

Returns:

a file read action

std::shared_ptr<FileReadAction> addFileReadAction(const std::string &name, const std::shared_ptr<FileLocation> &file_location)

Add a file read action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file_location – the file’s location

Returns:

a file read action

std::shared_ptr<FileReadAction> addFileReadAction(const std::string &name, const std::shared_ptr<FileLocation> &file_location, double num_bytes_to_read)

Add a file read action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file_location – the file’s location

  • num_bytes_to_read – the number of bytes to read

Returns:

a file read action

std::shared_ptr<FileReadAction> addFileReadAction(const std::string &name, const std::vector<std::shared_ptr<FileLocation>> &file_locations)

Add a file read action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file_locations – the locations to read the file from (will be tried in order until one succeeds)

Returns:

a file read action

std::shared_ptr<FileReadAction> addFileReadAction(const std::string &name, const std::vector<std::shared_ptr<FileLocation>> &file_locations, double num_bytes_to_read)

Add a file read action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file_locations – the locations to read the file from (will be tried in order until one succeeds)

  • num_bytes_to_read – number of bytes to read

Returns:

a file read action

std::shared_ptr<FileRegistryAddEntryAction> addFileRegistryAddEntryAction(const std::string &name, const std::shared_ptr<FileRegistryService> &file_registry, const std::shared_ptr<FileLocation> &file_location)

Add a file registry add entry action.

Parameters:
  • name – the action’s name

  • file_registry – the file registry

  • file_location – the file location

Returns:

std::shared_ptr<FileRegistryDeleteEntryAction> addFileRegistryDeleteEntryAction(const std::string &name, const std::shared_ptr<FileRegistryService> &file_registry, const std::shared_ptr<FileLocation> &file_location)

Add a file registry delete entry action.

Parameters:
  • name – the action’s name

  • file_registry – the file registry

  • file_location – the file location

Returns:

std::shared_ptr<FileWriteAction> addFileWriteAction(const std::string &name, const std::shared_ptr<DataFile> &file, const std::shared_ptr<StorageService> &storageService)

Add a file write action to a job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file – the file to write

  • storage_service – the storage service to write the file to

Returns:

a file write action

std::shared_ptr<FileWriteAction> addFileWriteAction(const std::string &name, const std::shared_ptr<FileLocation> &file_location)

Add a file write action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • file_location – the file’s location where it should be written

Returns:

a file write action

std::shared_ptr<MPIAction> addMPIAction(const std::string &name, const std::function<void(const std::shared_ptr<ExecutionController> &controller)> &mpi_code, unsigned long num_processes, unsigned long num_cores_per_process)

Add an MPI action to the job. The intended use-case for an MPI action is that never runs concurrently with other actions within its job, and that that job is submitted to a BatchComputeService, so that it has a set of resources dedicated to it. If the job is submitted to a BareMetalComputeService, this action will use all of that service’s resources, regardless of other running actions/jobs on that service.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • mpi_code – a lambda/function that implements the MPI code that MPI processes should execute

  • num_processes – the number of MPI processes that will be started.

  • num_cores_per_process – the number of core that each MPI process should use. Note that this is not enforced by the runtime system. If the processes compute with more cores, then they will cause time-sharing on cores.

Returns:

an MPI action

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)

Parameters:

parent – the parent job

std::shared_ptr<SleepAction> addSleepAction(const std::string &name, double sleep_time)

Add a sleep action to the job.

Parameters:
  • name – the action’s name (if empty, a unique name will be picked for you)

  • sleep_time – the time to sleep, in seconds

Returns:

a sleep action

std::set<std::shared_ptr<Action>> getActions()

Get the job’s actions.

Returns:

the set of actions in the job

std::set<std::shared_ptr<CompoundJob>> getChildrenJobs()

Get the job’s children.

Returns:

the (possibly empty) set of children jobs

double getMinimumRequiredMemory()

Get the minimum required amount of memory to run the job.

Returns:

a number of bytes

unsigned long getMinimumRequiredNumCores()

Get the minimum required num cores to run the job.

Returns:

a number of cores

std::set<std::shared_ptr<CompoundJob>> getParentJobs()

Get the job’s parents.

Returns:

the (possibly empty) set of parent jobs

inline std::shared_ptr<CompoundJob> getSharedPtr()

Get the shared pointer for this object.

Returns:

a shared pointer to the object

CompoundJob::State getState()

Get the state of the standard job.

Returns:

the state

std::string getStateAsString()

Get the state of the standard job.

Returns:

the state

bool hasFailed()

Return whether the job has terminated and has done so with some tasks having failed.

Returns:

true or false

bool hasSuccessfullyCompleted()

Return whether the job has terminated and has done so successfully.

Returns:

true or false

void removeAction(std::shared_ptr<Action> &action)

Remove an action from the job.

Parameters:

action – the action to remove

void setPriority(double p) override

Set the job’s priority (the higher the value, the higher the priority)

Parameters:

p – a priority