WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
Classes | Public Member Functions | Static Public Member Functions | List of all members
wrench::Workflow Class Reference

A workflow (to be executed by a WMS) More...

#include <Workflow.h>

Inheritance diagram for wrench::Workflow:

Public Member Functions

void addControlDependency (std::shared_ptr< WorkflowTask >src, 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. More...
 
std::shared_ptr< DataFileaddFile (std::string id, double size)
 Add a file to the workflow. More...
 
std::shared_ptr< WorkflowTaskaddTask (std::string, double flops, unsigned long min_num_cores, unsigned long max_num_cores, double memory_requirement)
 Create and add a new computational task to the workflow. More...
 
void clear ()
 Method that will delete all workflow tasks and all files used by these tasks.
 
void exportToEPS (std::string)
 Output the workflow's dependency graph to EPS. More...
 
double getCompletionDate ()
 Returns the workflow's completion date. More...
 
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. More...
 
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. More...
 
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. More...
 
std::vector< std::shared_ptr< WorkflowTask > > getExitTasks () const
 Get the exit tasks of the workflow, i.e., those tasks that don't have children. More...
 
std::shared_ptr< DataFilegetFileByID (const std::string &id)
 Get a file based on its ID. More...
 
std::map< std::string, std::shared_ptr< DataFile > > & getFileMap ()
 Get the list of all files in the workflow/simulation. More...
 
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) More...
 
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) More...
 
unsigned long getNumberOfTasks ()
 Get the number of tasks in the workflow. More...
 
unsigned long getNumLevels ()
 Returns the number of levels in the workflow. More...
 
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) More...
 
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) More...
 
std::map< std::string, std::vector< std::shared_ptr< WorkflowTask > > > getReadyClusters ()
 Get a map of clusters composed of ready tasks. More...
 
std::vector< std::shared_ptr< WorkflowTask > > getReadyTasks ()
 Get a vector of ready tasks. More...
 
std::shared_ptr< WorkflowgetSharedPtr ()
 Get the shared pointer for this object. More...
 
std::shared_ptr< WorkflowTaskgetTaskByID (const std::string &id)
 Find a WorkflowTask based on its ID. More...
 
std::vector< std::shared_ptr< WorkflowTask > > getTaskChildren (const std::shared_ptr< WorkflowTask >task)
 Get the list of children for a task. More...
 
std::map< std::string, std::shared_ptr< WorkflowTask > > getTaskMap ()
 Get the list of all tasks in the workflow. More...
 
long getTaskNumberOfChildren (const std::shared_ptr< WorkflowTask >task)
 Get the number of children for a task. More...
 
long getTaskNumberOfParents (const std::shared_ptr< WorkflowTask >task)
 Get the number of parents for a task. More...
 
std::vector< std::shared_ptr< WorkflowTask > > getTaskParents (const std::shared_ptr< WorkflowTask >task)
 Get the list of parents for a task. More...
 
std::vector< std::shared_ptr< WorkflowTask > > getTasks ()
 Get the list of all tasks in the workflow. More...
 
std::vector< std::shared_ptr< WorkflowTask > > getTasksInTopLevelRange (unsigned long min, unsigned long max)
 Returns all tasks with top-levels in a range. More...
 
std::set< std::shared_ptr< WorkflowTask > > getTasksThatInput (std::shared_ptr< DataFile > file)
 Find which tasks use a file as input. More...
 
std::shared_ptr< WorkflowTaskgetTaskThatOutputs (std::shared_ptr< DataFile > file)
 Get the workflow task for which a file is an output. More...
 
bool isDone ()
 Returns whether all tasks are complete. More...
 
bool isFileOutputOfSomeTask (std::shared_ptr< DataFile > file)
 Determine whether a file is output of some task. More...
 
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. More...
 
void removeControlDependency (std::shared_ptr< WorkflowTask >src, std::shared_ptr< WorkflowTask >dest)
 Remove a control dependency between tasks (does nothing if none) More...
 
void removeFile (std::shared_ptr< DataFile >file)
 Remove a file from the workflow. More...
 
void removeTask (std::shared_ptr< WorkflowTask >task)
 Remove a task from the workflow. More...
 

Static Public Member Functions

static std::shared_ptr< WorkflowcreateWorkflow ()
 Create a workflow instance. More...
 
static double getSumFlops (const std::vector< std::shared_ptr< WorkflowTask >> tasks)
 Get the total number of flops for a list of tasks. More...
 

Detailed Description

A workflow (to be executed by a WMS)

Member Function Documentation

◆ addControlDependency()

void wrench::Workflow::addControlDependency ( std::shared_ptr< WorkflowTask src,
std::shared_ptr< WorkflowTask dst,
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
srcthe parent task
dstthe child task
redundant_dependencieswhether DAG redundant dependencies should be kept in the graph
Exceptions
std::invalid_argument

◆ addFile()

std::shared_ptr< DataFile > wrench::Workflow::addFile ( std::string  id,
double  size 
)

Add a file to the workflow.

Parameters
id: file name
size: file size in bytes
Returns
a file

◆ addTask()

std::shared_ptr< WorkflowTask > wrench::Workflow::addTask ( std::string  id,
double  flops,
unsigned long  min_num_cores,
unsigned long  max_num_cores,
double  memory_requirement 
)

Create and add a new computational task to the workflow.

Parameters
ida unique string id
flopsnumber of flops
min_num_coresthe minimum number of cores required to run the task
max_num_coresthe maximum number of cores that can be used by the task (use INT_MAX for infinity)
memory_requirementmemory_manager_service requirement (in bytes)
Returns
the WorkflowTask instance
Exceptions
std::invalid_argument

◆ createWorkflow()

std::shared_ptr< Workflow > wrench::Workflow::createWorkflow ( )
static

Create a workflow instance.

Returns

◆ exportToEPS()

void wrench::Workflow::exportToEPS ( std::string  eps_filename)

Output the workflow's dependency graph to EPS.

Parameters
eps_filenamea filename to which the EPS content is saved

◆ getCompletionDate()

double wrench::Workflow::getCompletionDate ( )

Returns the workflow's completion date.

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

◆ getEntryTaskMap()

std::map< std::string, std::shared_ptr< WorkflowTask > > wrench::Workflow::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

◆ getEntryTasks()

std::vector< std::shared_ptr< WorkflowTask > > wrench::Workflow::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

◆ getExitTaskMap()

std::map< std::string, std::shared_ptr< WorkflowTask > > wrench::Workflow::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

◆ getExitTasks()

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

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

Returns
A vector of tasks

◆ getFileByID()

std::shared_ptr< DataFile > wrench::Workflow::getFileByID ( const std::string &  id)

Get a file based on its ID.

Parameters
id: file ID
Returns
a file

◆ getFileMap()

std::map< std::string, std::shared_ptr< DataFile > > & wrench::Workflow::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

◆ getInputFileMap()

std::map< std::string, std::shared_ptr< DataFile > > wrench::Workflow::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

◆ getInputFiles()

std::vector< std::shared_ptr< DataFile > > wrench::Workflow::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

◆ getNumberOfTasks()

unsigned long wrench::Workflow::getNumberOfTasks ( )

Get the number of tasks in the workflow.

Returns
the number of tasks

◆ getNumLevels()

unsigned long wrench::Workflow::getNumLevels ( )

Returns the number of levels in the workflow.

Returns
the number of levels

◆ getOutputFileMap()

std::map< std::string, std::shared_ptr< DataFile > > wrench::Workflow::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

◆ getOutputFiles()

std::vector< std::shared_ptr< DataFile > > wrench::Workflow::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

◆ getReadyClusters()

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

Get a map of clusters composed of ready tasks.

Returns
map of workflow cluster tasks

◆ getReadyTasks()

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

Get a vector of ready tasks.

Returns
a vector of tasks

◆ getSharedPtr()

std::shared_ptr<Workflow> wrench::Workflow::getSharedPtr ( )
inline

Get the shared pointer for this object.

Returns
a shared pointer to the object

◆ getSumFlops()

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

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

Parameters
tasksa vector of tasks
Returns
the total number of flops

◆ getTaskByID()

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

Find a WorkflowTask based on its ID.

Parameters
ida string id
Returns
a workflow task (or throws a std::invalid_argument if not found)
Exceptions
std::invalid_argument

◆ getTaskChildren()

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

Get the list of children for a task.

Parameters
taska workflow task
Returns
a vector of tasks

◆ getTaskMap()

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

Get the list of all tasks in the workflow.

Returns
a copy of themap of tasks, indexed by ID

◆ getTaskNumberOfChildren()

long wrench::Workflow::getTaskNumberOfChildren ( const std::shared_ptr< WorkflowTask task)

Get the number of children for a task.

Parameters
taska workflow task
Returns
a number of children

◆ getTaskNumberOfParents()

long wrench::Workflow::getTaskNumberOfParents ( const std::shared_ptr< WorkflowTask task)

Get the number of parents for a task.

Parameters
taska workflow task
Returns
a number of parents

◆ getTaskParents()

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

Get the list of parents for a task.

Parameters
taska workflow task
Returns
a vector of tasks

◆ getTasks()

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

Get the list of all tasks in the workflow.

Returns
a vector of tasks

◆ getTasksInTopLevelRange()

std::vector< std::shared_ptr< WorkflowTask > > wrench::Workflow::getTasksInTopLevelRange ( unsigned long  min,
unsigned long  max 
)

Returns all tasks with top-levels in a range.

Parameters
minthe low end of the range (inclusive)
maxthe high end of the range (inclusive)
Returns
a vector of tasks

◆ getTasksThatInput()

std::set< std::shared_ptr< WorkflowTask > > wrench::Workflow::getTasksThatInput ( std::shared_ptr< DataFile file)

Find which tasks use a file as input.

Parameters
file: a file
Returns
a vector of tasks

◆ getTaskThatOutputs()

std::shared_ptr< WorkflowTask > wrench::Workflow::getTaskThatOutputs ( std::shared_ptr< DataFile file)

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

Parameters
filea file
Returns
at task (or nullptr)

◆ isDone()

bool wrench::Workflow::isDone ( )

Returns whether all tasks are complete.

Returns
true or false

◆ isFileOutputOfSomeTask()

bool wrench::Workflow::isFileOutputOfSomeTask ( std::shared_ptr< DataFile file)

Determine whether a file is output of some task.

Parameters
filea file
Returns
true or false

◆ pathExists()

bool wrench::Workflow::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
srcthe source task
dstthe destination task
Returns
true if there is a path from src to dst, false otherwise

◆ removeControlDependency()

void wrench::Workflow::removeControlDependency ( std::shared_ptr< WorkflowTask src,
std::shared_ptr< WorkflowTask dst 
)

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

Parameters
srcthe source task
dstthe destination task

◆ removeFile()

void wrench::Workflow::removeFile ( std::shared_ptr< DataFile file)

Remove a file from the workflow.

Parameters
filea file
Exceptions
std::invalid_argument

◆ removeTask()

void wrench::Workflow::removeTask ( std::shared_ptr< WorkflowTask task)

Remove a task from the workflow.

Parameters
taska task
Exceptions
std::invalid_argument

The documentation for this class was generated from the following files: