wrench::Workflow

class Workflow : public std::enable_shared_from_this<Workflow>

A workflow (to be executed by a WMS)

Public Functions

void addControlDependency(const std::shared_ptr<WorkflowTask> &src, const std::shared_ptr<WorkflowTask> &dest, bool redundant_dependencies = false)

Create a control dependency between two workflow tasks. Will not do anything if there is already a path between the two tasks.

Parameters:
  • src – the parent task

  • dst – the child task

  • redundant_dependencies – whether DAG redundant dependencies should be kept in the graph

std::shared_ptr<WorkflowTask> addTask(const std::string&, double flops, unsigned long min_num_cores, unsigned long max_num_cores, sg_size_t memory_requirement)

Create and add a new computational task to the workflow.

Parameters:
  • id – a unique string id

  • flops – number of flops

  • min_num_cores – the minimum number of cores required to run the task

  • max_num_cores – the maximum number of cores that can be used by the task (use INT_MAX for infinity)

  • memory_requirement – memory_manager_service requirement (in bytes)

Returns:

the WorkflowTask instance

void clear()

Method that will delete all workflow tasks and all files used by these tasks.

void enableTopBottomLevelDynamicUpdates(bool enabled)

Enable dynamic top/bottom level updates.

Parameters:

enabled – true if dynamic updates are to be enabled, false otherwise

double getCompletionDate()

Returns the workflow’s completion date.

Returns:

a date in seconds (or a negative value If the workflow has not completed)

std::map<std::string, std::shared_ptr<WorkflowTask>> getEntryTaskMap() const

Get the list of exit tasks of the workflow, i.e., those tasks that don’t have parents.

Returns:

A map of tasks indexed by their IDs

std::vector<std::shared_ptr<WorkflowTask>> getEntryTasks() const

Get the list of exit tasks of the workflow, i.e., those tasks that don’t have parents.

Returns:

A vector of tasks

std::map<std::string, std::shared_ptr<WorkflowTask>> getExitTaskMap() const

Get the exit tasks of the workflow, i.e., those tasks that don’t have children.

Returns:

A map of tasks indexed by their IDs

std::vector<std::shared_ptr<WorkflowTask>> getExitTasks() const

Get the exit tasks of the workflow, i.e., those tasks that don’t have children.

Returns:

A vector of tasks

std::map<std::string, std::shared_ptr<DataFile>> &getFileMap()

Get the list of all files in the workflow/simulation.

Returns:

a reference to the map of files in the workflow/simulation, indexed by file ID

std::map<std::string, std::shared_ptr<DataFile>> getInputFileMap() const

Retrieve the list of the input files of the workflow (i.e., those files that are input to some tasks but output from none)

Returns:

a map of files indexed by file ID

std::vector<std::shared_ptr<DataFile>> getInputFiles() const

Retrieve the list of the input files of the workflow (i.e., those files that are input to some tasks but output from none)

Returns:

a vector of files

std::string getName() const

Name getter.

Returns:

The workflow’s name

unsigned long getNumberOfTasks()

Get the number of tasks in the workflow.

Returns:

the number of tasks

unsigned long getNumLevels()

Returns the number of levels in the workflow.

Returns:

the number of levels

std::map<std::string, std::shared_ptr<DataFile>> getOutputFileMap() const

Retrieve a list of the output files of the workflow (i.e., those files that are output from some tasks but input to none)

Returns:

a map of files indexed by ID

std::vector<std::shared_ptr<DataFile>> getOutputFiles() const

Retrieve a list of the output files of the workflow (i.e., those files that are output from some tasks but input to none)

Returns:

a vector of files

std::map<std::string, std::vector<std::shared_ptr<WorkflowTask>>> getReadyClusters()

Get a map of clusters composed of ready tasks.

Returns:

map of workflow cluster tasks

std::vector<std::shared_ptr<WorkflowTask>> getReadyTasks()

Get a vector of ready tasks.

Returns:

a vector of tasks

inline std::shared_ptr<Workflow> getSharedPtr()

Get the shared pointer for this object.

Returns:

a shared pointer to the object

double getStartDate()

Returns the workflow’s start date.

Returns:

a date in seconds (or a negative value if no workflow task has successfully completed)

std::shared_ptr<WorkflowTask> getTaskByID(const std::string &id)

Find a WorkflowTask based on its ID.

Parameters:

id – a string id

Returns:

a workflow task (or throws a std::invalid_argument if not found)

std::vector<std::shared_ptr<WorkflowTask>> getTaskChildren(const std::shared_ptr<WorkflowTask> &task)

Get the list of children for a task.

Parameters:

task – a workflow task

Returns:

a vector of tasks

std::map<std::string, std::shared_ptr<WorkflowTask>> getTaskMap()

Get the list of all tasks in the workflow.

Returns:

a copy of themap of tasks, indexed by ID

long getTaskNumberOfChildren(const std::shared_ptr<WorkflowTask> &task)

Get the number of children for a task.

Parameters:

task – a workflow task

Returns:

a number of children

long getTaskNumberOfParents(const std::shared_ptr<WorkflowTask> &task)

Get the number of parents for a task.

Parameters:

task – a workflow task

Returns:

a number of parents

std::vector<std::shared_ptr<WorkflowTask>> getTaskParents(const std::shared_ptr<WorkflowTask> &task)

Get the list of parents for a task.

Parameters:

task – a workflow task

Returns:

a vector of tasks

std::vector<std::shared_ptr<WorkflowTask>> getTasks()

Get the list of all tasks in the workflow.

Returns:

a vector of tasks

std::vector<std::shared_ptr<WorkflowTask>> getTasksInBottomLevelRange(int min, int max)

Returns all tasks with bottom-levels in a range.

Parameters:
  • min – the low end of the range (inclusive)

  • max – the high end of the range (inclusive)

Returns:

a vector of tasks

std::vector<std::shared_ptr<WorkflowTask>> getTasksInTopLevelRange(int min, int max)

Returns all tasks with top-levels in a range.

Parameters:
  • min – the low end of the range (inclusive)

  • max – the high end of the range (inclusive)

Returns:

a vector of tasks

std::set<std::shared_ptr<WorkflowTask>> getTasksThatInput(const std::shared_ptr<DataFile> &file)

Find which tasks use a file as input.

Parameters:

file – : a file

Returns:

a vector of tasks

std::shared_ptr<WorkflowTask> getTaskThatOutputs(const std::shared_ptr<DataFile> &file)

Get the workflow task for which a file is an output.

Parameters:

file – a file

Returns:

at task (or nullptr)

bool isDone()

Returns whether all tasks are complete.

Returns:

true or false

bool isFileOutputOfSomeTask(const std::shared_ptr<DataFile> &file)

Determine whether a file is output of some task.

Parameters:

file – a file

Returns:

true or false

bool pathExists(const std::shared_ptr<WorkflowTask> &src, const std::shared_ptr<WorkflowTask> &dst)

Determine whether one source is an ancestor of a destination task.

Parameters:
  • src – the source task

  • dst – the destination task

Returns:

true if there is a path from src to dst, false otherwise

void removeControlDependency(const std::shared_ptr<WorkflowTask> &src, const std::shared_ptr<WorkflowTask> &dest)

Remove a control dependency between tasks (does nothing if none)

Parameters:
  • src – the source task

  • dst – the destination task

void removeFile(const std::shared_ptr<DataFile> &file)

Remove a file from the workflow (but not from the simulation)

Parameters:

file – a file

void removeTask(const std::shared_ptr<WorkflowTask> &task)

Remove a task from the workflow.

Parameters:

task – a task

void updateAllTopBottomLevels()

Update the top level of all tasks (in case dynamic top level updates had been disabled)

Public Static Functions

static std::shared_ptr<Workflow> createWorkflow()

Create a workflow instance.

Returns:

static double getSumFlops(const std::vector<std::shared_ptr<WorkflowTask>> &tasks)

Get the total number of flops for a list of tasks.

Parameters:

tasks – a vector of tasks

Returns:

the total number of flops