wrench::WorkflowTask

class WorkflowTask : public std::enable_shared_from_this<WorkflowTask>

A computational task in a Workflow.

Public Types

enum InternalState

Task state enum.

Values:

enumerator TASK_NOT_READY
enumerator TASK_READY
enumerator TASK_RUNNING
enumerator TASK_COMPLETED
enumerator TASK_FAILED
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

int getBottomLevel() const

Returns the task’s bottom level (max number of hops on a path down to an exit task. Exit tasks have a bottom-level of 0)

Returns:

unsigned long getBytesRead() const

Get the number of bytes read by the task.

Returns:

number of bytes read by the task

unsigned long getBytesWritten() const

Get the number of bytes written by the task.

Returns:

number of bytes written by the task

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 task’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

WorkflowTask::InternalState getInternalState() const

Get the state of the task (as known to the “internal” layer)

Returns:

a task state

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 task’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)

int 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:

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 incrementFailureCount()

Increment the failure count of a task.

void setBytesRead(unsigned long)

Set the number of bytes read by the task.

Parameters:

b_read – number of bytes read by the task

void setBytesWritten(unsigned long)

Set the number of bytes written by the task.

Parameters:

b_written – number of bytes written by the task

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 setComputationEndDate(double date)

Set the date when the computation portion of a WorkflowTask has ended.

Parameters:

date – the date when the computation portion of the WorkflowTask has ended

Throws:

std::runtime_error

void setComputationStartDate(double date)

Set the date when the computation portion of a WorkflowTask has begun.

Parameters:

date – the date when the computation portion of the WorkflowTask has begun

Throws:

std::runtime_error

void setEndDate(double date)

Set the task’s end date.

Parameters:

date – the end date

Throws:

std::runtime_error

void setExecutionHost(const std::string &hostname)

Sets the host on which this task is running.If the hostname is a VM name, then the corresponding physical host name will be set!

Parameters:

hostname – the host name

void setFailureDate(double date)

Set the date when the task has failed.

Parameters:

date – the date when the task has failed

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 setInternalState(WorkflowTask::InternalState)

Set the internal state of the task.

Parameters:

state – the task’s internal state

void setJob(Job *j)

Set the task’s containing j.

Parameters:

j – the j

void setNumCoresAllocated(unsigned long num_cores)

Sets the number of cores allocated for this task.

Parameters:

num_cores – the number of cores allocated to this task

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

void setReadInputEndDate(double date)

Set the date when the read input portion of a WorkflowTask has completed.

Parameters:

date – the date when the read input portion of a WorkflowTask has completed

Throws:

std::runtime_error

void setReadInputStartDate(double date)

Set the date when the read input portion of a WorkflowTask has begun.

Parameters:

date – the date when the read input portion of a WorkflowTask has begun

Throws:

std::runtime_error

void setStartDate(double date)

Set the task’s start date (which pushing a new execution history!)

Parameters:

date – the start date

void setState(WorkflowTask::State)

Set the visible state of the task.

Parameters:

state – the task state

void setTerminationDate(double date)

Set the date when the task was terminated.

Parameters:

date – the date when the task was terminated

void setWriteOutputEndDate(double date)

Set the date when the write output portion of a WorkflowTask has completed.

Parameters:

date – the date when the write output portion of a task has completed

Throws:

std::runtime_error

void setWriteOutputStartDate(double date)

Set the date when the write output portion of a WorkflowTask has begun.

Parameters:

date – the date when the write output portion of a task has begun

Throws:

std::runtime_error

void updateReadiness()

Update task readiness.

void updateStartDate(double date)

Update the task’s start date.

Parameters:

date – the start date

Public Static Functions

static std::string stateToString(InternalState internal_state)

Get a task internal state as a string.

Parameters:

internal_state – the internal state

Returns:

an internal state as a string

static std::string stateToString(State state)

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

Parameters:

state – task state

Returns:

a string

struct WorkflowTaskExecution

A data structure that keeps track of a task’s execution event times.

Public Functions

inline explicit WorkflowTaskExecution(double task_start)

Constructor.

Parameters:

task_start – Task start time

Public Members

double computation_end = -1.0

Task’s computation end time.

double computation_start = -1.0

Task’s computation start time.

std::string execution_host

Task’s execution host (could be a virtual host)

unsigned long num_cores_allocated = 0

Task’s number of allocated cores.

std::string physical_execution_host

Task’s execution physical host.

double read_input_end = -1.0

Task’s read input end time.

double read_input_start = -1.0

Task’s read input start time.

double task_end = -1.0

Task’s end time.

double task_failed = -1.0

Task’s failed time.

double task_start = -1.0

Task’s start time.

double task_terminated = -1.0

Task’s terminated time.

double write_output_end = -1.0

Task’s write output end time.

double write_output_start = -1.0

Task’s write output start time.