10 #ifndef WRENCH_WORKFLOWTASK_H
11 #define WRENCH_WORKFLOWTASK_H
17 #include "wrench/workflow/job/WorkflowJob.h"
18 #include "wrench/workflow/WorkflowFile.h"
19 #include "wrench/workflow/parallel_model/ParallelModel.h"
20 #include "wrench/workflow/parallel_model/AmdahlParallelModel.h"
21 #include "wrench/workflow/parallel_model/ConstantEfficiencyParallelModel.h"
22 #include "wrench/workflow/parallel_model/CustomParallelModel.h"
24 #include <boost/graph/adjacency_list.hpp>
34 const std::string&
getID()
const;
54 std::vector<WorkflowTask *>
getParents()
const;
81 static std::string stateToString(WorkflowTask::State state);
83 WorkflowJob *
getJob()
const;
87 std::string getClusterID()
const;
89 void setClusterID(std::string);
91 void setPriority(
long);
93 unsigned long getPriority()
const;
95 void setAverageCPU(
double);
97 double getAverageCPU()
const;
99 void setBytesRead(
unsigned long);
101 unsigned long getBytesRead()
const;
103 void setBytesWritten(
unsigned long);
105 unsigned long getBytesWritten()
const;
107 std::vector<WorkflowFile *> getInputFiles()
const;
109 std::vector<WorkflowFile *> getOutputFiles()
const;
111 unsigned long getTopLevel()
const;
113 double getStartDate()
const;
115 double getEndDate()
const;
117 double getFailureDate()
const;
119 double getTerminationDate()
const;
121 double getReadInputStartDate()
const;
123 double getReadInputEndDate()
const;
125 double getComputationStartDate()
const;
127 double getComputationEndDate()
const;
129 double getWriteOutputStartDate()
const;
131 double getWriteOutputEndDate()
const;
133 unsigned long getNumCoresAllocated()
const;
135 struct WorkflowTaskExecution;
137 std::stack<WorkflowTaskExecution> getExecutionHistory()
const;
139 std::string getExecutionHost()
const;
141 std::string getPhysicalExecutionHost()
const ;
143 WorkflowTask::State getState()
const;
145 std::string getColor()
const;
147 void setColor(std::string);
167 static std::string stateToString(WorkflowTask::InternalState state);
169 unsigned long updateTopLevel();
171 void setInternalState(WorkflowTask::InternalState);
173 void setState(WorkflowTask::State);
175 void setUpcomingState(WorkflowTask::State);
177 WorkflowTask::State getUpcomingState()
const;
179 WorkflowTask::InternalState getInternalState()
const;
181 void setJob(WorkflowJob *job);
183 void setStartDate(
double date);
185 void setEndDate(
double date);
187 void setReadInputStartDate(
double date);
189 void setReadInputEndDate(
double date);
191 void setComputationStartDate(
double date);
193 void setComputationEndDate(
double date);
195 void setWriteOutputStartDate(
double date);
197 void setWriteOutputEndDate(
double date);
199 void setFailureDate(
double date);
201 void setTerminationDate(
double date);
203 void incrementFailureCount();
205 void setExecutionHost(std::string hostname);
207 void setNumCoresAllocated(
unsigned long num_cores);
212 struct WorkflowTaskExecution {
214 double task_start = -1.0;
216 double read_input_start = -1.0;
218 double read_input_end = -1.0;
220 double computation_start = -1.0;
222 double computation_end = -1.0;
224 double write_output_start = -1.0;
226 double write_output_end = -1.0;
228 double task_end = -1.0;
230 double task_failed = -1.0;
232 double task_terminated = -1.0;
235 std::string execution_host =
"";
237 std::string physical_execution_host =
"";
239 unsigned long num_cores_allocated = 0;
246 WorkflowTaskExecution(
double task_start) : task_start(task_start) {}
260 std::string cluster_id;
263 double average_cpu = -1;
264 unsigned long bytes_read = -1;
265 unsigned long bytes_written = -1;
266 unsigned long min_num_cores;
267 unsigned long max_num_cores;
268 std::shared_ptr<ParallelModel> parallel_model;
269 double memory_requirement;
270 unsigned long priority = 0;
271 unsigned long toplevel;
272 unsigned int failure_count = 0;
273 std::string execution_host;
275 State upcoming_visible_state;
276 InternalState internal_state;
280 std::map<std::string, WorkflowFile *> output_files;
281 std::map<std::string, WorkflowFile *> input_files;
286 unsigned long min_num_cores,
287 unsigned long max_num_cores,
288 double memory_requirement);
293 std::stack<WorkflowTaskExecution> execution_history;
295 friend class DagOfTasks;
299 #endif //WRENCH_WORKFLOWTASK_H
std::vector< WorkflowTask * > getChildren() const
Get the children of a task.
Definition: WorkflowTask.cpp:171
const std::string & getID() const
Get the id of the task.
Definition: WorkflowTask.cpp:117
void addInputFile(WorkflowFile *file)
Add an input file to the task.
Definition: WorkflowTask.cpp:57
unsigned long getMaxNumCores() const
Get the maximum number of cores that the task can use.
Definition: WorkflowTask.cpp:144
unsigned long getNumberOfChildren() const
Get the number of children of a task.
Definition: WorkflowTask.cpp:162
std::shared_ptr< WorkflowJob > getJob()
Get the executor's job.
Definition: StandardJobExecutor.cpp:990
A workflow (to be executed by a WMS)
Definition: Workflow.h:34
unsigned long getMinNumCores() const
Get the minimum number of cores required for running the task.
Definition: WorkflowTask.cpp:135
std::shared_ptr< ParallelModel > getParallelModel() const
Get the task's parallel model.
Definition: WorkflowTask.cpp:834
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:31
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
std::vector< WorkflowTask * > getParents() const
Get the parents of a task.
Definition: WorkflowTask.cpp:189
void addOutputFile(WorkflowFile *file)
Add an output file to the task.
Definition: WorkflowTask.cpp:87
unsigned long getNumberOfParents() const
Get the number of parents of a task.
Definition: WorkflowTask.cpp:180
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
double getFlops() const
Get the number of flops of the task.
Definition: WorkflowTask.cpp:126