10 #ifndef WRENCH_WORKFLOWTASK_H
11 #define WRENCH_WORKFLOWTASK_H
17 #include "wrench/workflow/job/WorkflowJob.h"
18 #include "wrench/workflow/WorkflowFile.h"
20 #include <boost/graph/adjacency_list.hpp>
30 std::string
getID()
const;
48 std::vector<WorkflowTask *>
getParents()
const;
75 static std::string stateToString(WorkflowTask::State state);
77 WorkflowJob *
getJob()
const;
81 std::string getClusterID()
const;
83 void setClusterID(std::string);
85 void setPriority(
long);
87 unsigned long getPriority()
const;
89 void setAverageCPU(
double);
91 double getAverageCPU()
const;
93 void setBytesRead(
unsigned long);
95 unsigned long getBytesRead()
const;
97 void setBytesWritten(
unsigned long);
99 unsigned long getBytesWritten()
const;
101 std::vector<WorkflowFile *> getInputFiles();
103 std::vector<WorkflowFile *> getOutputFiles();
105 unsigned long getTopLevel();
107 double getStartDate();
111 double getFailureDate();
113 double getTerminationDate();
115 double getReadInputStartDate();
117 double getReadInputEndDate();
119 double getComputationStartDate();
121 double getComputationEndDate();
123 double getWriteOutputStartDate();
125 double getWriteOutputEndDate();
127 unsigned long getNumCoresAllocated();
129 struct WorkflowTaskExecution;
131 std::stack<WorkflowTaskExecution> getExecutionHistory();
133 std::string getExecutionHost();
135 WorkflowTask::State getState()
const;
137 std::string getColor();
139 void setColor(std::string);
159 static std::string stateToString(WorkflowTask::InternalState state);
161 unsigned long updateTopLevel();
163 void setInternalState(WorkflowTask::InternalState);
165 void setState(WorkflowTask::State);
167 void setUpcomingState(WorkflowTask::State);
169 WorkflowTask::State getUpcomingState()
const;
171 WorkflowTask::InternalState getInternalState()
const;
173 void setJob(WorkflowJob *job);
175 void setStartDate(
double date);
177 void setEndDate(
double date);
179 void setReadInputStartDate(
double date);
181 void setReadInputEndDate(
double date);
183 void setComputationStartDate(
double date);
185 void setComputationEndDate(
double date);
187 void setWriteOutputStartDate(
double date);
189 void setWriteOutputEndDate(
double date);
191 void setFailureDate(
double date);
193 void setTerminationDate(
double date);
195 void incrementFailureCount();
197 void setExecutionHost(std::string hostname);
199 void setNumCoresAllocated(
unsigned long num_cores);
204 struct WorkflowTaskExecution {
206 double task_start = -1.0;
208 double read_input_start = -1.0;
210 double read_input_end = -1.0;
212 double computation_start = -1.0;
214 double computation_end = -1.0;
216 double write_output_start = -1.0;
218 double write_output_end = -1.0;
220 double task_end = -1.0;
222 double task_failed = -1.0;
224 double task_terminated = -1.0;
227 std::string execution_host =
"";
229 unsigned long num_cores_allocated = 0;
236 WorkflowTaskExecution(
double task_start) : task_start(task_start) {}
248 std::string cluster_id;
251 double average_cpu = -1;
252 unsigned long bytes_read = -1;
253 unsigned long bytes_written = -1;
254 unsigned long min_num_cores;
255 unsigned long max_num_cores;
256 double parallel_efficiency;
257 double memory_requirement;
258 unsigned long priority = 0;
259 unsigned long toplevel;
260 unsigned int failure_count = 0;
261 std::string execution_host;
263 State upcoming_visible_state;
264 InternalState internal_state;
268 std::map<std::string, WorkflowFile *> output_files;
269 std::map<std::string, WorkflowFile *> input_files;
274 unsigned long min_num_cores,
275 unsigned long max_num_cores,
276 double parallel_efficiency,
277 double memory_requirement);
282 std::stack<WorkflowTaskExecution> execution_history;
284 friend class DagOfTasks;
288 #endif //WRENCH_WORKFLOWTASK_H
std::string getID() const
Get the id of the task.
Definition: WorkflowTask.cpp:115
WorkflowJob * getJob()
Get the executor's job.
Definition: StandardJobExecutor.cpp:1015
std::vector< WorkflowTask * > getChildren() const
Get the children of a task.
Definition: WorkflowTask.cpp:178
void addInputFile(WorkflowFile *file)
Add an input file to the task.
Definition: WorkflowTask.cpp:55
unsigned long getMaxNumCores() const
Get the maximum number of cores that the task can use.
Definition: WorkflowTask.cpp:142
unsigned long getNumberOfChildren() const
Get the number of children of a task.
Definition: WorkflowTask.cpp:169
double getParallelEfficiency() const
Get the parallel efficiency of the task.
Definition: WorkflowTask.cpp:151
A workflow (to be executed by a WMS)
Definition: Workflow.h:33
unsigned long getMinNumCores() const
Get the minimum number of cores required for running the task.
Definition: WorkflowTask.cpp:133
A computational task in a Workflow.
Definition: WorkflowTask.h:27
unsigned int getFailureCount()
Get the number of times a task has failed.
Definition: WorkflowTask.cpp:603
double getMemoryRequirement() const
Get the memory requirement of the task.
Definition: WorkflowTask.cpp:160
std::vector< WorkflowTask * > getParents() const
Get the parents of a task.
Definition: WorkflowTask.cpp:196
void addOutputFile(WorkflowFile *file)
Add an output file to the task.
Definition: WorkflowTask.cpp:85
unsigned long getNumberOfParents() const
Get the number of parents of a task.
Definition: WorkflowTask.cpp:187
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:124