10 #ifndef WRENCH_WORKFLOWTASK_H 11 #define WRENCH_WORKFLOWTASK_H 15 #include <lemon/list_graph.h> 18 #include "wrench/workflow/job/WorkflowJob.h" 19 #include "wrench/workflow/WorkflowFile.h" 29 std::string
getID()
const;
45 std::vector<WorkflowTask *>
getParents()
const;
78 static std::string stateToString(WorkflowTask::State state);
80 WorkflowJob *getJob()
const;
84 std::string getClusterID()
const;
86 void setClusterID(std::string);
92 void setPriority(
long);
94 unsigned long getPriority()
const;
96 void setAverageCPU(
double);
98 double getAverageCPU()
const;
100 void setBytesRead(
unsigned long);
102 unsigned long getBytesRead()
const;
104 void setBytesWritten(
unsigned long);
106 unsigned long getBytesWritten()
const;
108 std::set<WorkflowFile *> getInputFiles();
110 std::set<WorkflowFile *> getOutputFiles();
112 unsigned long getTopLevel();
114 double getStartDate();
118 double getFailureDate();
120 double getTerminationDate();
122 double getReadInputStartDate();
124 double getReadInputEndDate();
126 double getComputationStartDate();
128 double getComputationEndDate();
130 double getWriteOutputStartDate();
132 double getWriteOutputEndDate();
134 unsigned long getNumCoresAllocated();
136 struct WorkflowTaskExecution;
138 std::stack<WorkflowTaskExecution> getExecutionHistory();
140 std::string getExecutionHost();
142 WorkflowTask::State getState()
const;
166 static std::string stateToString(WorkflowTask::InternalState state);
168 unsigned long updateTopLevel();
170 void setInternalState(WorkflowTask::InternalState);
172 void setState(WorkflowTask::State);
174 void setUpcomingState(WorkflowTask::State);
176 WorkflowTask::State getUpcomingState()
const;
178 WorkflowTask::InternalState getInternalState()
const;
180 void setJob(WorkflowJob *job);
182 void setStartDate(
double date);
184 void setEndDate(
double date);
186 void setReadInputStartDate(
double date);
188 void setReadInputEndDate(
double date);
190 void setComputationStartDate(
double date);
192 void setComputationEndDate(
double date);
194 void setWriteOutputStartDate(
double date);
196 void setWriteOutputEndDate(
double date);
198 void setFailureDate(
double date);
200 void setTerminationDate(
double date);
202 void incrementFailureCount();
204 void setExecutionHost(std::string hostname);
206 void setNumCoresAllocated(
unsigned long num_cores);
211 struct WorkflowTaskExecution {
213 double task_start = -1.0;
215 double read_input_start = -1.0;
217 double read_input_end = -1.0;
219 double computation_start = -1.0;
221 double computation_end = -1.0;
223 double write_output_start = -1.0;
225 double write_output_end = -1.0;
227 double task_end = -1.0;
229 double task_failed = -1.0;
231 double task_terminated = -1.0;
234 std::string execution_host =
"";
236 unsigned long num_cores_allocated = 0;
243 WorkflowTaskExecution(
double task_start) : task_start(task_start) { }
255 std::string cluster_id;
258 double average_cpu = -1;
259 unsigned long bytes_read = -1;
260 unsigned long bytes_written = -1;
261 unsigned long min_num_cores;
262 unsigned long max_num_cores;
263 double parallel_efficiency;
264 double memory_requirement;
265 unsigned long priority = 0;
266 unsigned long toplevel;
267 unsigned int failure_count = 0;
268 std::string execution_host;
270 State upcoming_visible_state;
271 InternalState internal_state;
274 lemon::ListDigraph *DAG;
275 lemon::ListDigraph::Node DAG_node;
276 std::map<std::string, WorkflowFile *> output_files;
277 std::map<std::string, WorkflowFile *> input_files;
283 unsigned long min_num_cores,
284 unsigned long max_num_cores,
285 double parallel_efficiency,
286 double memory_requirement);
296 std::stack<WorkflowTaskExecution> execution_history;
300 #endif //WRENCH_WORKFLOWTASK_H double getMemoryRequirement() const
Get the memory requirement of the task.
Definition: WorkflowTask.cpp:163
std::vector< WorkflowTask * > getParents() const
Get the parents of a task.
Definition: WorkflowTask.cpp:208
unsigned long getMaxNumCores() const
Get the maximum number of cores that the task can use.
Definition: WorkflowTask.cpp:145
void addOutputFile(WorkflowFile *file)
Add an output file to the task.
Definition: WorkflowTask.cpp:86
unsigned long getMinNumCores() const
Get the minimum number of cores required for running the task.
Definition: WorkflowTask.cpp:136
A computational task in a Workflow.
Definition: WorkflowTask.h:26
unsigned int getFailureCount()
Get the number of times a task has failed.
Definition: WorkflowTask.cpp:617
std::vector< WorkflowTask * > getChildren() const
Get the children of a task.
Definition: WorkflowTask.cpp:186
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
A workflow (to be executed by a WMS)
Definition: Workflow.h:30
double getParallelEfficiency() const
Get the parallel efficiency of the task.
Definition: WorkflowTask.cpp:154
double getFlops() const
Get the number of flops of the task.
Definition: WorkflowTask.cpp:127
unsigned long getNumberOfParents() const
Get the number of parents of a task.
Definition: WorkflowTask.cpp:195
std::string getID() const
Get the id of the task.
Definition: WorkflowTask.cpp:118
unsigned long getNumberOfChildren() const
Get the number of children of a task.
Definition: WorkflowTask.cpp:173
void addInputFile(WorkflowFile *file)
Add an input file to the task.
Definition: WorkflowTask.cpp:56