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;
76 static std::string stateToString(WorkflowTask::State state);
78 WorkflowJob *getJob()
const;
82 std::string getClusterID()
const;
84 void setClusterID(std::string);
86 void setTaskType(TaskType);
88 TaskType getTaskType()
const;
90 void setPriority(
long);
92 long getPriority()
const;
94 void setAverageCPU(
double);
96 double getAverageCPU()
const;
98 void setBytesRead(
unsigned long);
100 unsigned long getBytesRead()
const;
102 void setBytesWritten(
unsigned long);
104 unsigned long getBytesWritten()
const;
106 std::set<WorkflowFile *> getInputFiles();
108 std::set<WorkflowFile *> getOutputFiles();
110 unsigned long getTopLevel();
112 double getStartDate();
116 double getFailureDate();
118 double getTerminationDate();
120 double getReadInputStartDate();
122 double getReadInputEndDate();
124 double getComputationStartDate();
126 double getComputationEndDate();
128 double getWriteOutputStartDate();
130 double getWriteOutputEndDate();
132 unsigned long getNumCoresAllocated();
134 struct WorkflowTaskExecution;
136 std::stack<WorkflowTaskExecution> getExecutionHistory();
138 std::string getExecutionHost();
140 WorkflowTask::State getState()
const;
142 void addSrcDest(
WorkflowFile *,
const std::string &,
const std::string &);
144 std::map<WorkflowFile *, std::pair<std::string, std::string>> getFileTransfers()
const;
164 static std::string stateToString(WorkflowTask::InternalState state);
166 unsigned long updateTopLevel();
168 void setInternalState(WorkflowTask::InternalState);
170 void setState(WorkflowTask::State);
172 void setUpcomingState(WorkflowTask::State);
174 WorkflowTask::State getUpcomingState()
const;
176 WorkflowTask::InternalState getInternalState()
const;
178 void setJob(WorkflowJob *job);
180 void setStartDate(
double date);
182 void setEndDate(
double date);
184 void setReadInputStartDate(
double date);
186 void setReadInputEndDate(
double date);
188 void setComputationStartDate(
double date);
190 void setComputationEndDate(
double date);
192 void setWriteOutputStartDate(
double date);
194 void setWriteOutputEndDate(
double date);
196 void setFailureDate(
double date);
198 void setTerminationDate(
double date);
200 void incrementFailureCount();
202 void setExecutionHost(std::string hostname);
204 void setNumCoresAllocated(
unsigned long num_cores);
206 struct WorkflowTaskExecution {
207 double task_start = -1.0;
208 double read_input_start = -1.0;
209 double read_input_end = -1.0;
210 double computation_start = -1.0;
211 double computation_end = -1.0;
212 double write_output_start = -1.0;
213 double write_output_end = -1.0;
214 double task_end = -1.0;
215 double task_failed = -1.0;
216 double task_terminated = -1.0;
218 std::string execution_host =
"";
219 unsigned long num_cores_allocated = 0;
221 WorkflowTaskExecution(
double task_start) : task_start(task_start) {
234 std::string cluster_id;
237 double average_cpu = -1;
238 unsigned long bytes_read = -1;
239 unsigned long bytes_written = -1;
240 unsigned long min_num_cores;
241 unsigned long max_num_cores;
242 double parallel_efficiency;
243 double memory_requirement;
245 unsigned long toplevel;
246 unsigned int failure_count = 0;
247 std::string execution_host;
249 State upcoming_visible_state;
250 InternalState internal_state;
253 lemon::ListDigraph *DAG;
254 lemon::ListDigraph::Node DAG_node;
255 std::map<std::string, WorkflowFile *> output_files;
256 std::map<std::string, WorkflowFile *> input_files;
257 std::map<WorkflowFile *, std::pair<std::string, std::string>> fileTransfers;
262 unsigned long min_num_cores,
263 unsigned long max_num_cores,
264 double parallel_efficiency,
265 double memory_requirement,
272 void addFileToMap(std::map<std::string, WorkflowFile *> &map_to_insert,
273 std::map<std::string, WorkflowFile *> &map_to_check,
276 std::stack<WorkflowTaskExecution> execution_history;
280 #endif //WRENCH_WORKFLOWTASK_H int getNumberOfChildren() const
Get the number of children of a task.
Definition: WorkflowTask.cpp:145
double getMemoryRequirement() const
Get the memory requirement of the task.
Definition: WorkflowTask.cpp:135
unsigned long getMaxNumCores() const
Get the maximum number of cores that the task can use.
Definition: WorkflowTask.cpp:117
void addOutputFile(WorkflowFile *file)
Add an output file to the task.
Definition: WorkflowTask.cpp:72
unsigned long getMinNumCores() const
Get the minimum number of cores required for running the task.
Definition: WorkflowTask.cpp:108
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:609
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:126
double getFlops() const
Get the number of flops of the task.
Definition: WorkflowTask.cpp:99
int getNumberOfParents() const
Get the number of parents of a task.
Definition: WorkflowTask.cpp:158
std::string getID() const
Get the id of the task.
Definition: WorkflowTask.cpp:90
void addInputFile(WorkflowFile *file)
Add an input file to the task.
Definition: WorkflowTask.cpp:54
Definition: TerminalOutput.cpp:15