10 #ifndef WRENCH_WORKFLOWTASK_H
11 #define WRENCH_WORKFLOWTASK_H
19 #include "wrench/job/Job.h"
20 #include "wrench/data_file/DataFile.h"
21 #include "wrench/workflow/parallel_model/ParallelModel.h"
22 #include "wrench/workflow/parallel_model/AmdahlParallelModel.h"
23 #include "wrench/workflow/parallel_model/ConstantEfficiencyParallelModel.h"
24 #include "wrench/workflow/parallel_model/CustomParallelModel.h"
26 #include <boost/graph/adjacency_list.hpp>
33 class WorkflowTask :
public std::enable_shared_from_this<WorkflowTask> {
36 const std::string&
getID()
const;
52 std::vector<std::shared_ptr<WorkflowTask>>
getChildren();
56 std::vector<std::shared_ptr<WorkflowTask>>
getParents();
64 std::shared_ptr<WorkflowTask> getSharedPtr() {
return this->shared_from_this(); }
111 std::vector<std::shared_ptr<DataFile>>
getInputFiles()
const;
139 struct WorkflowTaskExecution;
270 std::string cluster_id;
273 double average_cpu = -1;
274 unsigned long bytes_read = -1;
275 unsigned long bytes_written = -1;
276 unsigned long min_num_cores;
277 unsigned long max_num_cores;
278 std::shared_ptr<ParallelModel> parallel_model;
279 double memory_requirement;
280 unsigned long priority = 0;
281 unsigned long toplevel;
282 unsigned int failure_count = 0;
283 std::string execution_host;
285 State upcoming_visible_state;
288 std::shared_ptr<Workflow> workflow;
290 std::map<std::string, std::shared_ptr<DataFile>> output_files;
291 std::map<std::string, std::shared_ptr<DataFile>> input_files;
296 unsigned long min_num_cores,
297 unsigned long max_num_cores,
298 double memory_requirement);
303 std::stack<WorkflowTaskExecution> execution_history;
309 #endif //WRENCH_WORKFLOWTASK_H
@ PENDING
Pending (has been submitted to a compute service)
Definition: WorkflowTask.h:78
std::vector< std::shared_ptr< DataFile > > getInputFiles() const
Get the list of input DataFile objects for the task.
Definition: WorkflowTask.cpp:611
@ READY
Ready (parents have completed)
Definition: WorkflowTask.h:76
An internal class that uses the Boost Graph Library to implement a DAG of WorkflowTask objects.
Definition: DagOfTasks.h:50
void addInputFile(std::shared_ptr< DataFile >file)
Add an input file to the task.
Definition: WorkflowTask.cpp:57
std::string execution_host
Task's execution host (could be a virtual host)
Definition: WorkflowTask.h:245
void incrementFailureCount()
Increment the failure count of a task.
Definition: WorkflowTask.cpp:603
std::stack< WorkflowTaskExecution > getExecutionHistory() const
Get the execution history of this task.
Definition: WorkflowTask.cpp:587
double write_output_end
Task's write output end time.
Definition: WorkflowTask.h:236
std::vector< std::shared_ptr< DataFile > > getOutputFiles() const
Get the list of output DataFile objects for the task.
Definition: WorkflowTask.cpp:624
@ UNKNOWN
Some Unknown state (should not happen)
Definition: WorkflowTask.h:82
WorkflowTask::State getState() const
Get the state of the task.
Definition: WorkflowTask.cpp:198
State
Task states.
Definition: WorkflowTask.h:72
std::shared_ptr< Workflow > getWorkflow() const
Get the workflow that contains the task.
Definition: WorkflowTask.cpp:291
unsigned long updateTopLevel()
Update the task's top level (looking only at the parents, and updating children)
Definition: WorkflowTask.cpp:717
Abstraction of a job used for executing tasks in a Workflow.
Definition: Job.h:34
std::string getStateAsString() const
Get the state of the task as a string.
Definition: WorkflowTask.cpp:207
void setComputationEndDate(double date)
Set the date when the computation portion of a WorkflowTask has ended.
Definition: WorkflowTask.cpp:485
double getAverageCPU() const
Get the task average CPU usage.
Definition: WorkflowTask.cpp:383
void setClusterID(std::string)
Set the cluster id for the task.
Definition: WorkflowTask.cpp:359
void setExecutionHost(std::string hostname)
Sets the host on which this task is running.If the hostname is a VM name, then the corresponding phys...
Definition: WorkflowTask.cpp:775
double read_input_end
Task's read input end time.
Definition: WorkflowTask.h:228
double getTerminationDate() const
Get the tasks's most recent termination date (when it was explicitly requested to be terminated by th...
Definition: WorkflowTask.cpp:709
WorkflowTask::InternalState getInternalState() const
Get the state of the task (as known to the "internal" layer)
Definition: WorkflowTask.cpp:237
const std::string & getID() const
Get the id of the task.
Definition: WorkflowTask.cpp:117
void setTerminationDate(double date)
Set the date when the task was terminated.
Definition: WorkflowTask.cpp:573
double getComputationStartDate() const
Get the tasks's most recent computation start date.
Definition: WorkflowTask.cpp:653
void setNumCoresAllocated(unsigned long num_cores)
Sets the number of cores allocated for this task.
Definition: WorkflowTask.cpp:797
double write_output_start
Task's write output start time.
Definition: WorkflowTask.h:234
void setComputationStartDate(double date)
Set the date when the computation portion of a WorkflowTask has begun.
Definition: WorkflowTask.cpp:470
unsigned long getMaxNumCores() const
Get the maximum number of cores that the task can use.
Definition: WorkflowTask.cpp:144
double task_end
Task's end time.
Definition: WorkflowTask.h:238
double read_input_start
Task's read input start time.
Definition: WorkflowTask.h:226
void setBytesWritten(unsigned long)
Set the number of bytes written by the task.
Definition: WorkflowTask.cpp:423
void setReadInputEndDate(double date)
Set the date when the read input portion of a WorkflowTask has completed.
Definition: WorkflowTask.cpp:515
Job * getJob() const
Get the task's containing job.
Definition: WorkflowTask.cpp:342
unsigned long getTopLevel() const
Returns the task's top level (max number of hops on a reverse path up to an entry task....
Definition: WorkflowTask.cpp:740
void setFailureDate(double date)
Set the date when the task has failed.
Definition: WorkflowTask.cpp:559
Definition: Action.cpp:28
void setJob(Job *job)
Set the task's containing job.
Definition: WorkflowTask.cpp:334
A workflow (to be executed by a WMS)
Definition: Workflow.h:34
void updateStartDate(double date)
Update the task's start date.
Definition: WorkflowTask.cpp:441
@ COMPLETED
Completed (successfully completed)
Definition: WorkflowTask.h:80
static std::string stateToString(WorkflowTask::State state)
Convert task state to a string (useful for output, debugging, logging, etc.)
Definition: WorkflowTask.cpp:246
void setPriority(long)
Set the task priority.
Definition: WorkflowTask.cpp:375
unsigned long num_cores_allocated
Task's number of allocated cores.
Definition: WorkflowTask.h:249
unsigned long getMinNumCores() const
Get the minimum number of cores required for running the task.
Definition: WorkflowTask.cpp:135
unsigned long getBytesWritten() const
Get the number of bytes written by the task.
Definition: WorkflowTask.cpp:415
void updateReadiness()
Update task readiness.
Definition: WorkflowTask.cpp:841
double getFailureDate() const
Get the task's most recent failure date.
Definition: WorkflowTask.cpp:701
double task_failed
Task's failed time.
Definition: WorkflowTask.h:240
std::shared_ptr< ParallelModel > getParallelModel() const
Get the task's parallel model.
Definition: WorkflowTask.cpp:834
void setState(WorkflowTask::State)
Set the visible state of the task.
Definition: WorkflowTask.cpp:310
double computation_end
Task's computation end time.
Definition: WorkflowTask.h:232
void setParallelModel(std::shared_ptr< ParallelModel > model)
Set the task's parallel model.
Definition: WorkflowTask.cpp:826
A computational task in a Workflow.
Definition: WorkflowTask.h:33
std::string getPhysicalExecutionHost() const
Returns the name of the PHYSICAL host on which the task has most recently been executed,...
Definition: WorkflowTask.cpp:758
double computation_start
Task's computation start time.
Definition: WorkflowTask.h:230
unsigned long getNumberOfChildren()
Get the number of children of a task.
Definition: WorkflowTask.cpp:162
std::string physical_execution_host
Task's execution physical host.
Definition: WorkflowTask.h:247
unsigned int getFailureCount()
Get the number of times a task has failed.
Definition: WorkflowTask.cpp:596
double getMemoryRequirement() const
Get the memory_manager_service requirement of the task.
Definition: WorkflowTask.cpp:153
A data structure that keeps track of a task's execution event times.
Definition: WorkflowTask.h:222
unsigned long getNumberOfParents()
Get the number of parents of a task.
Definition: WorkflowTask.cpp:180
void setBytesRead(unsigned long)
Set the number of bytes read by the task.
Definition: WorkflowTask.cpp:407
double getStartDate() const
Get the task's most recent start date.
Definition: WorkflowTask.cpp:637
double getWriteOutputStartDate() const
Get the task's most recent write output start date.
Definition: WorkflowTask.cpp:685
std::string getExecutionHost() const
Returns the name of the host on which the task has most recently been executed, or "" if the task has...
Definition: WorkflowTask.cpp:749
void setStartDate(double date)
Set the task's start date (which pushing a new execution history!)
Definition: WorkflowTask.cpp:432
std::vector< std::shared_ptr< WorkflowTask > > getChildren()
Get the children of a task.
Definition: WorkflowTask.cpp:171
WorkflowTaskExecution(double task_start)
Constructor.
Definition: WorkflowTask.h:256
double getReadInputStartDate() const
Get the task's most recent read input start date.
Definition: WorkflowTask.cpp:669
unsigned long getPriority() const
Get the task priority. By default, priority is 0.
Definition: WorkflowTask.cpp:367
std::string getClusterID() const
Get the cluster Id for the task.
Definition: WorkflowTask.cpp:350
unsigned long getBytesRead() const
Get the number of bytes read by the task.
Definition: WorkflowTask.cpp:399
InternalState
Task state enum.
Definition: WorkflowTask.h:165
std::vector< std::shared_ptr< WorkflowTask > > getParents()
Get the parents of a task.
Definition: WorkflowTask.cpp:189
void addOutputFile(std::shared_ptr< DataFile >file)
Add an output file to the task.
Definition: WorkflowTask.cpp:87
@ NOT_READY
Not ready (parents have not completed)
Definition: WorkflowTask.h:74
void setEndDate(double date)
Set the task's end date.
Definition: WorkflowTask.cpp:456
void setWriteOutputEndDate(double date)
Set the date when the write output portion of a WorkflowTask has completed.
Definition: WorkflowTask.cpp:545
void setInternalState(WorkflowTask::InternalState)
Set the internal state of the task.
Definition: WorkflowTask.cpp:300
double getReadInputEndDate() const
Get the task's most recent read input end date.
Definition: WorkflowTask.cpp:677
void setReadInputStartDate(double date)
Set the date when the read input portion of a WorkflowTask has begun.
Definition: WorkflowTask.cpp:500
double getWriteOutputEndDate() const
Get the task's most recent write output end date.
Definition: WorkflowTask.cpp:693
void setAverageCPU(double)
Set the task average CPU usage.
Definition: WorkflowTask.cpp:391
double task_start
Task's start time.
Definition: WorkflowTask.h:224
void setWriteOutputStartDate(double date)
Set the date when the write output portion of a WorkflowTask has begun.
Definition: WorkflowTask.cpp:530
double getEndDate() const
Get the task's most recent end date.
Definition: WorkflowTask.cpp:645
unsigned long getNumCoresAllocated() const
Returns the number of cores allocated for this task's most recent execution or 0 if an execution atte...
Definition: WorkflowTask.cpp:766
double getFlops() const
Get the number of flops of the task.
Definition: WorkflowTask.cpp:126
std::string getColor() const
Get the task's color ("" if none)
Definition: WorkflowTask.cpp:810
void setColor(std::string)
Set the task's color.
Definition: WorkflowTask.cpp:818
double getComputationEndDate() const
Get the task's most recent computation end date.
Definition: WorkflowTask.cpp:661
double task_terminated
Task's terminated time.
Definition: WorkflowTask.h:242