A computational task in a Workflow. More...

#include <WorkflowTask.h>

Classes

struct  WorkflowTaskExecution
 A data structure that keeps track of a task's execution event times. More...
 

Public Types

enum  InternalState {
  TASK_NOT_READY, TASK_READY, TASK_RUNNING, TASK_COMPLETED,
  TASK_FAILED
}
 Task state enum.
 
enum  State {
  NOT_READY, READY, PENDING, COMPLETED,
  UNKNOWN
}
 Task states. More...
 

Public Member Functions

void addInputFile (WorkflowFile *file)
 Add an input file to the task. More...
 
void addOutputFile (WorkflowFile *file)
 Add an output file to the task. More...
 
double getAverageCPU () const
 Get the task average CPU usage. More...
 
unsigned long getBytesRead () const
 Get the number of bytes read by the task. More...
 
unsigned long getBytesWritten () const
 Get the number of bytes written by the task. More...
 
std::vector< WorkflowTask * > getChildren () const
 Get the children of a task. More...
 
std::string getClusterID () const
 Get the cluster Id for the task. More...
 
std::string getColor ()
 Get the task's color ("" if none) More...
 
double getComputationEndDate ()
 Get the task's most recent computation end date. More...
 
double getComputationStartDate ()
 Get the tasks's most recent computation start date. More...
 
double getEndDate ()
 Get the task's most recent end date. More...
 
std::stack< WorkflowTaskExecutiongetExecutionHistory ()
 Get the execution history of this task. More...
 
std::string getExecutionHost ()
 Returns the name of the host on which the task has most recently been executed, or "" if the task has never been executed yet. More...
 
unsigned int getFailureCount ()
 Get the number of times a task has failed. More...
 
double getFailureDate ()
 Get the task's most recent failure date. More...
 
double getFlops () const
 Get the number of flops of the task. More...
 
std::string getID () const
 Get the id of the task. More...
 
std::vector< WorkflowFile * > getInputFiles ()
 Get the list of input WorkflowFile objects for the task. More...
 
WorkflowTask::InternalState getInternalState () const
 Get the state of the task (as known to the "internal" layer) More...
 
WorkflowJobgetJob () const
 Get the task's containing job. More...
 
unsigned long getMaxNumCores () const
 Get the maximum number of cores that the task can use. More...
 
double getMemoryRequirement () const
 Get the memory requirement of the task. More...
 
unsigned long getMinNumCores () const
 Get the minimum number of cores required for running the task. More...
 
unsigned long getNumberOfChildren () const
 Get the number of children of a task. More...
 
unsigned long getNumberOfParents () const
 Get the number of parents of a task. More...
 
unsigned long getNumCoresAllocated ()
 Returns the number of cores allocated for this task's most recent execution or 0 if an execution attempt was never made. More...
 
std::vector< WorkflowFile * > getOutputFiles ()
 Get the list of output WorkflowFile objects for the task. More...
 
std::shared_ptr< ParallelModelgetParallelModel ()
 Get the task's parallel model. More...
 
std::vector< WorkflowTask * > getParents () const
 Get the parents of a task. More...
 
unsigned long getPriority () const
 Get the task priority. By default, priority is 0. More...
 
double getReadInputEndDate ()
 Get the task's most recent read input end date. More...
 
double getReadInputStartDate ()
 Get the task's most recent read input start date. More...
 
double getStartDate ()
 Get the task's most recent start date. More...
 
WorkflowTask::State getState () const
 Get the state of the task. More...
 
double getTerminationDate ()
 Get the tasks's most recent termination date (when it was explicitly requested to be terminated by the WMS) More...
 
unsigned long getTopLevel ()
 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) More...
 
WorkflowTask::State getUpcomingState () const
 Get the state of the task. More...
 
WorkflowgetWorkflow () const
 Get the workflow that contains the task. More...
 
double getWriteOutputEndDate ()
 Get the task's most recent write output end date. More...
 
double getWriteOutputStartDate ()
 Get the task's most recent write output start date. More...
 
void incrementFailureCount ()
 Increment the failure count of a task.
 
void setAverageCPU (double)
 Set the task average CPU usage. More...
 
void setBytesRead (unsigned long)
 Set the number of bytes read by the task. More...
 
void setBytesWritten (unsigned long)
 Set the number of bytes written by the task. More...
 
void setClusterID (std::string)
 Set the cluster id for the task. More...
 
void setColor (std::string)
 Set the task's color. More...
 
void setComputationEndDate (double date)
 Set the date when the computation portion of a WorkflowTask has ended. More...
 
void setComputationStartDate (double date)
 Set the date when the computation portion of a WorkflowTask has begun. More...
 
void setEndDate (double date)
 Set the task's end date. More...
 
void setExecutionHost (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! More...
 
void setFailureDate (double date)
 Set the date when the task has failed. More...
 
void setInternalState (WorkflowTask::InternalState)
 Set the internal state of the task. More...
 
void setJob (WorkflowJob *job)
 Set the task's containing job. More...
 
void setNumCoresAllocated (unsigned long num_cores)
 Sets the number of cores allocated for this task. More...
 
void setParallelModel (std::shared_ptr< ParallelModel > model)
 Set the task's parallel model. More...
 
void setPriority (long)
 Set the task priority. More...
 
void setReadInputEndDate (double date)
 Set the date when the read input portion of a WorkflowTask has completed. More...
 
void setReadInputStartDate (double date)
 Set the date when the read input portion of a WorkflowTask has begun. More...
 
void setStartDate (double date)
 Set the task's start date. More...
 
void setState (WorkflowTask::State)
 Set the visible state of the task. More...
 
void setTerminationDate (double date)
 Set the date when the task was terminated. More...
 
void setUpcomingState (WorkflowTask::State)
 Set the upcoming visible state of the task. More...
 
void setWriteOutputEndDate (double date)
 Set the date when the write output portion of a WorkflowTask has completed. More...
 
void setWriteOutputStartDate (double date)
 Set the date when the write output portion of a WorkflowTask has begun. More...
 
unsigned long updateTopLevel ()
 Update the task's top level (looking only at the parents, and updating children) More...
 

Static Public Member Functions

static std::string stateToString (WorkflowTask::InternalState state)
 Get a task internal state as a string. More...
 
static std::string stateToString (WorkflowTask::State state)
 Convert task state to a string (useful for output, debugging, logging, etc.) More...
 

Detailed Description

A computational task in a Workflow.

Member Enumeration Documentation

◆ State

Task states.

Enumerator
NOT_READY 

Not ready (parents have not completed)

READY 

Ready (parents have completed)

PENDING 

Pending (has been submitted to a compute service)

COMPLETED 

Completed (successfully completed)

UNKNOWN 

Some Unknown state (should not happen)

Member Function Documentation

◆ addInputFile()

void wrench::WorkflowTask::addInputFile ( WorkflowFile file)

Add an input file to the task.

Parameters
filethe file
Exceptions
std::invalid_argument

◆ addOutputFile()

void wrench::WorkflowTask::addOutputFile ( WorkflowFile file)

Add an output file to the task.

Parameters
filethe file

◆ getAverageCPU()

double wrench::WorkflowTask::getAverageCPU ( ) const

Get the task average CPU usage.

Returns
the task average CPU usage

◆ getBytesRead()

unsigned long wrench::WorkflowTask::getBytesRead ( ) const

Get the number of bytes read by the task.

Returns
number of bytes read by the task in KB

◆ getBytesWritten()

unsigned long wrench::WorkflowTask::getBytesWritten ( ) const

Get the number of bytes written by the task.

Returns
number of bytes written by the task in KB

◆ getChildren()

std::vector< WorkflowTask * > wrench::WorkflowTask::getChildren ( ) const

Get the children of a task.

Returns
a list of workflow tasks

◆ getClusterID()

std::string wrench::WorkflowTask::getClusterID ( ) const

Get the cluster Id for the task.

Returns
a cluster id, or an empty string

◆ getColor()

std::string wrench::WorkflowTask::getColor ( )

Get the task's color ("" if none)

Returns
A color string in "#rrggbb" format

◆ getComputationEndDate()

double wrench::WorkflowTask::getComputationEndDate ( )

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)

◆ getComputationStartDate()

double wrench::WorkflowTask::getComputationStartDate ( )

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)

◆ getEndDate()

double wrench::WorkflowTask::getEndDate ( )

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)

◆ getExecutionHistory()

std::stack< WorkflowTask::WorkflowTaskExecution > wrench::WorkflowTask::getExecutionHistory ( )

Get the execution history of this task.

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

◆ getExecutionHost()

std::string wrench::WorkflowTask::getExecutionHost ( )

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

Returns
hostname

◆ getFailureCount()

unsigned int wrench::WorkflowTask::getFailureCount ( )

Get the number of times a task has failed.

Returns
a failure count

◆ getFailureDate()

double wrench::WorkflowTask::getFailureDate ( )

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)

◆ getFlops()

double wrench::WorkflowTask::getFlops ( ) const

Get the number of flops of the task.

Returns
a number of flops

◆ getID()

std::string wrench::WorkflowTask::getID ( ) const

Get the id of the task.

Returns
an id as a string

◆ getInputFiles()

std::vector< WorkflowFile * > wrench::WorkflowTask::getInputFiles ( )

Get the list of input WorkflowFile objects for the task.

Returns
a list workflow files

◆ getInternalState()

WorkflowTask::InternalState wrench::WorkflowTask::getInternalState ( ) const

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

Returns
a task state

◆ getJob()

WorkflowJob * wrench::WorkflowTask::getJob ( ) const

Get the task's containing job.

Returns
job: the job

◆ getMaxNumCores()

unsigned long wrench::WorkflowTask::getMaxNumCores ( ) const

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

Returns
a number of cores

◆ getMemoryRequirement()

double wrench::WorkflowTask::getMemoryRequirement ( ) const

Get the memory requirement of the task.

Returns
a memory requirement (in bytes)

◆ getMinNumCores()

unsigned long wrench::WorkflowTask::getMinNumCores ( ) const

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

Returns
a number of cores

◆ getNumberOfChildren()

unsigned long wrench::WorkflowTask::getNumberOfChildren ( ) const

Get the number of children of a task.

Returns
a number of children

◆ getNumberOfParents()

unsigned long wrench::WorkflowTask::getNumberOfParents ( ) const

Get the number of parents of a task.

Returns
a number of parents

◆ getNumCoresAllocated()

unsigned long wrench::WorkflowTask::getNumCoresAllocated ( )

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

◆ getOutputFiles()

std::vector< WorkflowFile * > wrench::WorkflowTask::getOutputFiles ( )

Get the list of output WorkflowFile objects for the task.

Returns
a list of workflow files

◆ getParallelModel()

std::shared_ptr< ParallelModel > wrench::WorkflowTask::getParallelModel ( )

Get the task's parallel model.

Returns
the parallel model

◆ getParents()

std::vector< WorkflowTask * > wrench::WorkflowTask::getParents ( ) const

Get the parents of a task.

Returns
a list of workflow tasks

◆ getPriority()

unsigned long wrench::WorkflowTask::getPriority ( ) const

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

Returns
the task priority

◆ getReadInputEndDate()

double wrench::WorkflowTask::getReadInputEndDate ( )

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)

◆ getReadInputStartDate()

double wrench::WorkflowTask::getReadInputStartDate ( )

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)

◆ getStartDate()

double wrench::WorkflowTask::getStartDate ( )

Get the task's most recent start date.

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

◆ getState()

WorkflowTask::State wrench::WorkflowTask::getState ( ) const

Get the state of the task.

Returns
a task state

◆ getTerminationDate()

double wrench::WorkflowTask::getTerminationDate ( )

Get the tasks's most recent termination date (when it was explicitly requested to be terminated by the WMS)

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

◆ getTopLevel()

unsigned long wrench::WorkflowTask::getTopLevel ( )

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

◆ getUpcomingState()

WorkflowTask::State wrench::WorkflowTask::getUpcomingState ( ) const

Get the state of the task.

Returns
a task state

◆ getWorkflow()

Workflow * wrench::WorkflowTask::getWorkflow ( ) const

Get the workflow that contains the task.

Returns
a workflow

◆ getWriteOutputEndDate()

double wrench::WorkflowTask::getWriteOutputEndDate ( )

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)

◆ getWriteOutputStartDate()

double wrench::WorkflowTask::getWriteOutputStartDate ( )

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)

◆ setAverageCPU()

void wrench::WorkflowTask::setAverageCPU ( double  average_cpu)

Set the task average CPU usage.

Parameters
average_cputask average CPU usage

◆ setBytesRead()

void wrench::WorkflowTask::setBytesRead ( unsigned long  bytes_read)

Set the number of bytes read by the task.

Parameters
bytes_readnumber of bytes read by the task in KB

◆ setBytesWritten()

void wrench::WorkflowTask::setBytesWritten ( unsigned long  bytes_written)

Set the number of bytes written by the task.

Parameters
bytes_writtennumber of bytes written by the task in KB

◆ setClusterID()

void wrench::WorkflowTask::setClusterID ( std::string  id)

Set the cluster id for the task.

Parameters
idcluster id the task belongs to

◆ setColor()

void wrench::WorkflowTask::setColor ( std::string  color)

Set the task's color.

Parameters
colorA color string in "#rrggbb" format

◆ setComputationEndDate()

void wrench::WorkflowTask::setComputationEndDate ( double  date)

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

Parameters
datethe date when the computation portion of the WorkflowTask has ended
Exceptions
std::runtime_error

◆ setComputationStartDate()

void wrench::WorkflowTask::setComputationStartDate ( double  date)

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

Parameters
datethe date when the computation portion of the WorkflowTask has begun
Exceptions
std::runtime_error

◆ setEndDate()

void wrench::WorkflowTask::setEndDate ( double  date)

Set the task's end date.

Parameters
datethe end date
Exceptions
std::runtime_error

◆ setExecutionHost()

void wrench::WorkflowTask::setExecutionHost ( 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
hostnamethe host name

Convert the hostname to a physical hostname if needed

◆ setFailureDate()

void wrench::WorkflowTask::setFailureDate ( double  date)

Set the date when the task has failed.

Parameters
datethe date when the task has failed

◆ setInternalState()

void wrench::WorkflowTask::setInternalState ( WorkflowTask::InternalState  state)

Set the internal state of the task.

Parameters
statethe task's internal state

◆ setJob()

void wrench::WorkflowTask::setJob ( WorkflowJob job)

Set the task's containing job.

Parameters
jobthe job

◆ setNumCoresAllocated()

void wrench::WorkflowTask::setNumCoresAllocated ( unsigned long  num_cores)

Sets the number of cores allocated for this task.

Parameters
num_coresthe number of cores allocated to this task

◆ setParallelModel()

void wrench::WorkflowTask::setParallelModel ( std::shared_ptr< ParallelModel model)

Set the task's parallel model.

Parameters
modela parallel model

◆ setPriority()

void wrench::WorkflowTask::setPriority ( long  priority)

Set the task priority.

Parameters
prioritytask priority

◆ setReadInputEndDate()

void wrench::WorkflowTask::setReadInputEndDate ( double  date)

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

Parameters
datethe date when the read input portion of a WorkflowTask has completed
Exceptions
std::runtime_error

◆ setReadInputStartDate()

void wrench::WorkflowTask::setReadInputStartDate ( double  date)

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

Parameters
datethe date when the read input portion of a WorkflowTask has begun
Exceptions
std::runtime_error

◆ setStartDate()

void wrench::WorkflowTask::setStartDate ( double  date)

Set the task's start date.

Parameters
datethe start date

◆ setState()

void wrench::WorkflowTask::setState ( WorkflowTask::State  state)

Set the visible state of the task.

Parameters
statethe task state

◆ setTerminationDate()

void wrench::WorkflowTask::setTerminationDate ( double  date)

Set the date when the task was terminated.

Parameters
datethe date when the task was terminated

◆ setUpcomingState()

void wrench::WorkflowTask::setUpcomingState ( WorkflowTask::State  state)

Set the upcoming visible state of the task.

Parameters
statethe task state

◆ setWriteOutputEndDate()

void wrench::WorkflowTask::setWriteOutputEndDate ( double  date)

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

Parameters
datethe date when the write output portion of a task has completed
Exceptions
std::runtime_error

◆ setWriteOutputStartDate()

void wrench::WorkflowTask::setWriteOutputStartDate ( double  date)

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

Parameters
datethe date when the write output portion of a task has begun
Exceptions
std::runtime_error

◆ stateToString() [1/2]

std::string wrench::WorkflowTask::stateToString ( WorkflowTask::InternalState  state)
static

Get a task internal state as a string.

Parameters
statethe internal state
Returns
an internal state as a string

◆ stateToString() [2/2]

std::string wrench::WorkflowTask::stateToString ( WorkflowTask::State  state)
static

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

Parameters
statetask state
Returns
a string

◆ updateTopLevel()

unsigned long wrench::WorkflowTask::updateTopLevel ( )

Update the task's top level (looking only at the parents, and updating children)

Returns
the task's updated top level

The documentation for this class was generated from the following files: