wrench::WorkflowTask

class wrench::WorkflowTask : public std::enable_shared_from_this<WorkflowTask>

A computational task in a Workflow.

Public Types

enum State

Task states.

Values:

enumerator NOT_READY

Not ready (parents have not completed)

enumerator READY

Ready (parents have completed)

enumerator PENDING

Pending (has been submitted to a compute service)

enumerator COMPLETED

Completed (successfully completed)

enumerator UNKNOWN

Some Unknown state (should not happen)

Public Functions

void addInputFile(const std::shared_ptr<DataFile> &file)

Add an input file to the task.

Parameters

file – the file

Throws

std::invalid_argument

void addOutputFile(const std::shared_ptr<DataFile> &file)

Add an output file to the task.

Parameters

file – the file

double getAverageCPU() const

Get the task average CPU usage.

Returns

the task average CPU usage

unsigned long getBytesRead() const

Get the number of bytes read by the task.

Returns

number of bytes read by the task in KB

unsigned long getBytesWritten() const

Get the number of bytes written by the task.

Returns

number of bytes written by the task in KB

std::vector<std::shared_ptr<WorkflowTask>> getChildren()

Get the children of a task.

Returns

a list of workflow tasks

std::string getClusterID() const

Get the cluster Id for the task.

Returns

a cluster id, or an empty string

std::string getColor() const

Get the task’s color (”” if none)

Returns

A color string in “#rrggbb” format

double getComputationEndDate() const

Get the task’s most recent computation end date.

Returns

the date when the computation portion of a task ended (-1 if computation has not ended yet or if no execution history exists for this task yet)

double getComputationStartDate() const

Get the tasks’s most recent computation start date.

Returns

the date when the computation portion of a task started (-1 if computation has not started yet or if no execution history exists for this task yet)

double getEndDate() const

Get the task’s most recent end date.

Returns

a end date (-1 if task has not completed yet or if no execution history exists for this task yet)

std::stack<WorkflowTaskExecution> getExecutionHistory() const

Get the execution history of this task.

Returns

a stack of WorkflowTaskExecution objects, one for each attempted execution of the task

std::string getExecutionHost() const

Returns the name of the host on which the task has most recently been executed, or “” if the task has never been executed yet. Could be a virtual hostname.

Returns

hostname

unsigned int getFailureCount() const

Get the number of times a task has failed.

Returns

a failure count

double getFailureDate() const

Get the task’s most recent failure date.

Returns

the date when the task failed (-1 if it didn’t fail or if no execution history exists for this task yet)

double getFlops() const

Get the number of flops of the task.

Returns

a number of flops

const std::string &getID() const

Get the id of the task.

Returns

an id as a string

std::vector<std::shared_ptr<DataFile>> getInputFiles() const

Get the list of input DataFile objects for the task.

Returns

a list workflow files

Job *getJob() const

Get the task’s containing job.

Returns

job: the job

unsigned long getMaxNumCores() const

Get the maximum number of cores that the task can use.

Returns

a number of cores

double getMemoryRequirement() const

Get the memory_manager_service requirement of the task.

Returns

a memory_manager_service requirement (in bytes)

unsigned long getMinNumCores() const

Get the minimum number of cores required for running the task.

Returns

a number of cores

unsigned long getNumberOfChildren()

Get the number of children of a task.

Returns

a number of children

unsigned long getNumberOfParents()

Get the number of parents of a task.

Returns

a number of parents

unsigned long getNumCoresAllocated() const

Returns the number of cores allocated for this task’s most recent execution or 0 if an execution attempt was never made.

Returns

number of cores

std::vector<std::shared_ptr<DataFile>> getOutputFiles() const

Get the list of output DataFile objects for the task.

Returns

a list of workflow files

std::shared_ptr<ParallelModel> getParallelModel() const

Get the task’s parallel model.

Returns

the parallel model

std::vector<std::shared_ptr<WorkflowTask>> getParents()

Get the parents of a task.

Returns

a list of workflow tasks

std::string getPhysicalExecutionHost() const

Returns the name of the PHYSICAL host on which the task has most recently been executed, or “” if the task has never been executed yet.

Returns

hostname

unsigned long getPriority() const

Get the task priority. By default, priority is 0.

Returns

the task priority

double getReadInputEndDate() const

Get the task’s most recent read input end date.

Returns

the date when the read input portion of the task has completed (-1 if it has not begun or if no execution history exists for this task yet)

double getReadInputStartDate() const

Get the task’s most recent read input start date.

Returns

the date when the read input portion of the task has begun (-1 if it has not yet begun or if no execution history exists for this task yet)

inline std::shared_ptr<WorkflowTask> getSharedPtr()

Retrieved the official shared pointer for this object.

Returns

a shared pointer

double getStartDate() const

Get the task’s most recent start date.

Returns

a start date (-1 if task has not started yet)

WorkflowTask::State getState() const

Get the state of the task.

Returns

a task state

std::string getStateAsString() const

Get the state of the task as a string.

Returns

a string

double getTerminationDate() const

Get the tasks’s most recent termination date (when it was explicitly requested to be terminated by the execution controller)

Returns

the date when the task was terminated (-1 if it wasn’t terminated or if not execution history exists for this task yet)

unsigned long getTopLevel() const

Returns the task’s top level (max number of hops on a reverse path up to an entry task. Entry tasks have a top-level of 0)

Returns

std::shared_ptr<Workflow> getWorkflow() const

Get the workflow that contains the task.

Returns

a workflow

double getWriteOutputEndDate() const

Get the task’s most recent write output end date.

Returns

the date when the write output portion of a task has completed (-1 if it has not completed yet or if no execution history exists for this task yet)

double getWriteOutputStartDate() const

Get the task’s most recent write output start date.

Returns

the date when the write output portion of a task has begun (-1 if it has not yet started or if no execution history exists for this task yet)

void setAverageCPU(double)

Set the task average CPU usage.

Parameters

a_cpu – task average CPU usage

void setBytesRead(unsigned long)

Set the number of bytes read by the task.

Parameters

b_read – number of bytes read by the task in KB

void setBytesWritten(unsigned long)

Set the number of bytes written by the task.

Parameters

b_written – number of bytes written by the task in KB

void setClusterID(const std::string&)

Set the cluster c_id for the task.

Parameters

c_id – cluster c_id the task belongs to

void setColor(const std::string&)

Set the task’s color.

Parameters

c – A color string in “#rrggbb” format

void setFlops(double f)

Set the number of f of the task (to be used only in very specific cases in which it is guaranteed that changing a task’s work after that task has been created is a valid thing to do)

Parameters

f – the number of f

void setParallelModel(std::shared_ptr<ParallelModel> model)

Set the task’s parallel model.

Parameters

model – a parallel model

void setPriority(long)

Set the task p.

Parameters

p – task p

Public Static Functions

static std::string stateToString(State state)

Convert task state to a string (useful for output, debugging, logging, etc.)

Get a task internal state as a string.

Parameters
  • state – task state

  • internal_state – the internal state

Returns

a string

Returns

an internal state as a string