A workflow (to be executed by a WMS) More...
#include <Workflow.h>
Public Member Functions | |
Workflow () | |
Constructor. | |
void | addControlDependency (WorkflowTask *src, 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... | |
WorkflowFile * | addFile (std::string, double) |
Add a new file to the workflow. More... | |
WorkflowTask * | addTask (std::string, double flops, unsigned long min_num_cores, unsigned long max_num_cores, double parallel_efficiency, double memory_requirement, WorkflowTask::TaskType type=WorkflowTask::TaskType::COMPUTE) |
Create and add a new computational task to the workflow. More... | |
void | exportToEPS (std::string) |
Output the workflow's dependency graph to EPS. More... | |
double | getCompletionDate () |
Sets the number of levels in the workflow. More... | |
WorkflowFile * | getFileByID (const std::string &id) |
Find a WorkflowFile based on its ID. More... | |
std::vector< WorkflowFile * > | getFiles () |
Get the list of all files in the workflow. More... | |
std::map< std::string, WorkflowFile * > | getInputFiles () |
Retrieve a map (indexed by file id) of input files for a 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::vector< WorkflowTask * > > | getReadyClusters () |
Get a map of clusters composed of ready tasks. More... | |
std::vector< WorkflowTask * > | getReadyTasks () |
Get a vector of ready tasks. More... | |
WorkflowTask * | getTaskByID (const std::string &id) |
Find a WorkflowTask based on its ID. More... | |
std::vector< WorkflowTask * > | getTaskChildren (const WorkflowTask *task) |
Get the list of children for a task. More... | |
std::vector< WorkflowTask * > | getTaskParents (const WorkflowTask *task) |
Get the list of parents for a task. More... | |
std::vector< WorkflowTask * > | getTasks () |
Get the list of all tasks in the workflow. More... | |
std::vector< WorkflowTask * > | getTasksInTopLevelRange (unsigned long min, unsigned long max) |
Returns all tasks with top-levels in a range. More... | |
bool | isDone () |
Returns whether all tasks are complete. More... | |
void | loadFromDAX (const std::string &filename, const std::string &reference_flop_rate, bool redundant_dependencies=false) |
Create a workflow based on a DAX file. More... | |
void | loadFromDAXorJSON (const std::string &filename, const std::string &reference_flop_rate, bool redundant_dependencies=false) |
Create a workflow based on a DAX or a JSON file. More... | |
void | loadFromJSON (const std::string &filename, const std::string &reference_flop_rate, bool redundant_dependencies=false) |
Create a workflow based on a JSON file. More... | |
void | removeTask (WorkflowTask *task) |
Remove a task from the workflow. WARNING: this method de-allocated memory for the task, making any pointer to the task invalid. More... | |
Static Public Member Functions | |
static double | getSumFlops (std::vector< 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 | ( | WorkflowTask * | src, |
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
-
src the parent task dst the child task redundant_dependencies whether DAG redundant dependencies should be kept in the graph
- Exceptions
-
std::invalid_argument
◆ addFile()
WorkflowFile * wrench::Workflow::addFile | ( | std::string | id, |
double | size | ||
) |
Add a new file to the workflow.
- Parameters
-
id a unique string id size a file size in bytes
- Returns
- the WorkflowFile instance
- Exceptions
-
std::invalid_argument
◆ addTask()
WorkflowTask * wrench::Workflow::addTask | ( | std::string | id, |
double | flops, | ||
unsigned long | min_num_cores, | ||
unsigned long | max_num_cores, | ||
double | parallel_efficiency, | ||
double | memory_requirement, | ||
WorkflowTask::TaskType | type = WorkflowTask::TaskType::COMPUTE |
||
) |
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) parallel_efficiency the multi-core parallel efficiency (number between 0.0 and 1.0) memory_requirement memory requirement (in bytes) type workflow task type (WorkflowTask::TaskType)
- Returns
- the WorkflowTask instance
- Exceptions
-
std::invalid_argument
◆ exportToEPS()
void wrench::Workflow::exportToEPS | ( | std::string | eps_filename | ) |
Output the workflow's dependency graph to EPS.
- Parameters
-
eps_filename a filename to which the EPS content is saved
◆ getCompletionDate()
double wrench::Workflow::getCompletionDate | ( | ) |
Sets the number of levels in the workflow.
- Parameters
-
num_levels the number of levels Returns the workflow's completion date
- Returns
- a date in seconds (or a negative value If the workflow has not completed)
◆ getFileByID()
WorkflowFile * wrench::Workflow::getFileByID | ( | const std::string & | id | ) |
Find a WorkflowFile based on its ID.
- Parameters
-
id a string id
- Returns
- the WorkflowFile instance (or throws a std::invalid_argument if not found)
- Exceptions
-
std::invalid_argument
◆ getFiles()
std::vector< WorkflowFile * > wrench::Workflow::getFiles | ( | ) |
Get the list of all files in the workflow.
- Returns
- a vector of files
◆ getInputFiles()
std::map< std::string, WorkflowFile * > wrench::Workflow::getInputFiles | ( | ) |
Retrieve a map (indexed by file id) of input files for a workflow (i.e., those files that are input to some tasks but output from none)
- Returns
- a std::map 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
◆ getReadyClusters()
std::map< std::string, std::vector< WorkflowTask * > > wrench::Workflow::getReadyClusters | ( | ) |
Get a map of clusters composed of ready tasks.
- Returns
- map of workflow cluster tasks
◆ getReadyTasks()
std::vector< WorkflowTask * > wrench::Workflow::getReadyTasks | ( | ) |
Get a vector of ready tasks.
- Returns
- a vector of tasks
◆ getSumFlops()
|
static |
Get the total number of flops for a list of tasks.
- Parameters
-
tasks list of tasks
- Returns
- the total number of flops
◆ getTaskByID()
WorkflowTask * wrench::Workflow::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)
- Exceptions
-
std::invalid_argument
◆ getTaskChildren()
std::vector< WorkflowTask * > wrench::Workflow::getTaskChildren | ( | const WorkflowTask * | task | ) |
Get the list of children for a task.
- Parameters
-
task a workflow task
- Returns
- a vector of tasks
◆ getTaskParents()
std::vector< WorkflowTask * > wrench::Workflow::getTaskParents | ( | const WorkflowTask * | task | ) |
Get the list of parents for a task.
- Parameters
-
task a workflow task
- Returns
- a vector of tasks
◆ getTasks()
std::vector< WorkflowTask * > wrench::Workflow::getTasks | ( | ) |
Get the list of all tasks in the workflow.
- Returns
- a vector of tasks
◆ getTasksInTopLevelRange()
std::vector< WorkflowTask * > wrench::Workflow::getTasksInTopLevelRange | ( | unsigned long | min, |
unsigned long | 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
◆ isDone()
bool wrench::Workflow::isDone | ( | ) |
Returns whether all tasks are complete.
- Returns
- true or false
◆ loadFromDAX()
void wrench::Workflow::loadFromDAX | ( | const std::string & | filename, |
const std::string & | reference_flop_rate, | ||
bool | redundant_dependencies = false |
||
) |
Create a workflow based on a DAX file.
- Parameters
-
filename the path to the DAX file reference_flop_rate a reference compute speed (in flops/sec), assuming a task's computation is purely flops. This is needed because DAX files specify task execution times in seconds, but the WRENCH simulation needs some notion of "amount of computation" to apply reasonable scaling. (Because the XML platform description specifies host compute speeds in flops/sec). The times in the DAX file are thus assumed to be obtained on an machine with flop rate reference_flop_rate. redundant_dependencies whether DAG redundant dependencies should be kept in the graph
- Exceptions
-
std::invalid_argument
◆ loadFromDAXorJSON()
void wrench::Workflow::loadFromDAXorJSON | ( | const std::string & | filename, |
const std::string & | reference_flop_rate, | ||
bool | redundant_dependencies = false |
||
) |
Create a workflow based on a DAX or a JSON file.
- Parameters
-
filename the path to the DAX (with .dax extension) or JSON (with .json extension) file reference_flop_rate a reference compute speed (in flops/sec), assuming a task's computation is purely flops. This is needed because JSON files specify task execution times in seconds, but the WRENCH simulation needs some notion of "amount of computation" to apply reasonable scaling. (Because the XML platform description specifies host compute speeds in flops/sec). The times in the JSON file are thus assumed to be obtained on an machine with flop rate reference_flop_rate. redundant_dependencies whether DAG redundant dependencies should be kept in the graph
- Exceptions
-
std::invalid_argument
◆ loadFromJSON()
void wrench::Workflow::loadFromJSON | ( | const std::string & | filename, |
const std::string & | reference_flop_rate, | ||
bool | redundant_dependencies = false |
||
) |
Create a workflow based on a JSON file.
- Parameters
-
filename the path to the JSON file reference_flop_rate a reference compute speed (in flops/sec), assuming a task's computation is purely flops. This is needed because JSON files specify task execution times in seconds, but the WRENCH simulation needs some notion of "amount of computation" to apply reasonable scaling. (Because the XML platform description specifies host compute speeds in flops/sec). The times in the JSON file are thus assumed to be obtained on an machine with flop rate reference_flop_rate. redundant_dependencies whether DAG redundant dependencies should be kept in the graph
- Exceptions
-
std::invalid_argument
◆ removeTask()
void wrench::Workflow::removeTask | ( | WorkflowTask * | task | ) |
Remove a task from the workflow. WARNING: this method de-allocated memory for the task, making any pointer to the task invalid.
- Parameters
-
task a task
- Exceptions
-
std::invalid_argument
The documentation for this class was generated from the following files:
- /Users/rafsilva/Documents/isi/workspace/wrench/wrench/include/wrench/workflow/Workflow.h
- /Users/rafsilva/Documents/isi/workspace/wrench/wrench/src/wrench/workflow/Workflow.cpp