Class Task

java.lang.Object
co.yellowdog.platform.model.Task
All Implemented Interfaces:
Identified, Named, Tagged, Serializable

@ValidatedBy(TaskValidator.class) public class Task extends Object implements Identified, Named, Tagged, Serializable
Defines a task to be executed as part of a WorkRequirement.
See Also:
  • Constructor Details

    • Task

      public Task(String name, String tag, String taskType, List<String> arguments, String taskData, Map<String,String> environment, List<TaskInput> inputs, FlattenPath flattenInputPaths, List<TaskOutput> outputs, Duration timeout, TaskData data)
      Constructs a new task with the specified values.
      Parameters:
      name - the task name
      tag - the task tag
      taskType - the task type
      taskData - the task initialisation data
      environment - the task environment
      inputs - the task inputs
      flattenInputPaths - how input paths should be flattened
      outputs - the task outputs
      timeout - the task timeout
  • Method Details

    • builder

      public static Task.Builder builder()
    • toBuilder

      public Task.Builder toBuilder()
    • getId

      public String getId()
      Description copied from interface: Identified
      Returns the ID
      Specified by:
      getId in interface Identified
      Returns:
      the ID
    • getName

      public String getName()
      The user allocated name used to uniquely identify the task within its task group.
      Specified by:
      getName in interface Named
      Returns:
      the task name
    • getFullyQualifiedName

      public String getFullyQualifiedName()
      The system generated fully qualified name of the task in the form {namespace}/{workRequirementName}/{taskGroupName}/{taskName}. This is only generated if all ancestor entities are named.
      Returns:
      the fully qualified task name
    • getTag

      public String getTag()
      Description copied from interface: Tagged
      Gets the user defined tag
      Specified by:
      getTag in interface Tagged
      Returns:
      the user defined tag
    • getTaskType

      public String getTaskType()
      The type of the task, used to identify the program to use to execute the task.
      Returns:
      the task type
    • getStatus

      public TaskStatus getStatus()
      The task status.
      Returns:
      the task status
    • getRetryCount

      public Integer getRetryCount()
      How many times the task has failed and then been set back to WAITING to be retried.
      Returns:
      the current task retry count
    • getArguments

      public List<@NotNull String> getArguments()
      A list of arguments that will be passed to the task type run command when the task is executed.
      Returns:
      a list of arguments for the task run command
    • getTaskData

      public String getTaskData()
      The data to be passed to the Worker when the task is started.
      Returns:
      the task input data
    • getEnvironment

      public Map<@NotBlank String,String> getEnvironment()
      A map containing environment variable values that will be added to the process environment when the task is executed.
      Returns:
      a map containing environment variable values
    • getStartedTime

      public Instant getStartedTime()
      The time the task was last started by a Worker.
      Returns:
      the time the task was last started
    • getFinishedTime

      public Instant getFinishedTime()
      The time the task was finished.
      Returns:
      the time the task was finished
    • getAbortRequestedTime

      public Instant getAbortRequestedTime()
      The time when task abort was requested.
      Returns:
      the time when task abort was requested
    • getInputs

      public List<@NotNull @Valid TaskInput> getInputs()
      Input object specifications that determine objects to be downloaded prior to running the task.
      Returns:
      input object specifications for the task
    • getFlattenInputPaths

      public FlattenPath getFlattenInputPaths()
      Indicates if the input objects' paths should be flattened when they are downloaded.
      Returns:
      if the input objects' paths should be flattened
    • getOutputs

      public List<@NotNull @Valid TaskOutput> getOutputs()
      Output object specifications that determine objects to be uploaded after running the task.
      Returns:
      output object specifications for the task
    • getData

      public TaskData getData()
      Task data requirement specifications.
    • getTimeout

      public Duration getTimeout()
      The maximum time that a worker should attempt to execute the task for before failing it.
      Returns:
      the maximum time that a worker should attempt to execute the task for before failing it
    • getTaskGroupId

      public String getTaskGroupId()
    • getWorkerId

      public String getWorkerId()
    • getErrors

      public List<TaskError> getErrors()
    • setId

      public void setId(String id)
    • setName

      public void setName(String name)
      The user allocated name used to uniquely identify the task within its task group.
      Parameters:
      name - the task name
      This should not be changed once the requirement has been submitted to YellowDog Scheduler.
    • setFullyQualifiedName

      public void setFullyQualifiedName(String fullyQualifiedName)
      The system generated fully qualified name of the task in the form {namespace}/{workRequirementName}/{taskGroupName}/{taskName}. This is only generated if all ancestor entities are named.
      Parameters:
      fullyQualifiedName - This should not be set outside of the YellowDog Scheduler service.
    • setTag

      public void setTag(String tag)
      Description copied from interface: Tagged
      Sets the user defined tag
      Specified by:
      setTag in interface Tagged
      Parameters:
      tag - the user defined tag
    • setTaskType

      public void setTaskType(String taskType)
      The type of the task, used to identify the program to use to execute the task.
      Parameters:
      taskType - the task type
      This should not be changed once the requirement has been submitted to YellowDog Scheduler.
    • setStatus

      public void setStatus(TaskStatus status)
      The task status.
      Parameters:
      status - This should not be set outside of the YellowDog Scheduler service.
    • setRetryCount

      public void setRetryCount(Integer retryCount)
      How many times the task has failed and then been set back to WAITING to be retried.
      Parameters:
      retryCount - This should not be set outside of the YellowDog Scheduler service.
    • setArguments

      public void setArguments(List<@NotNull String> arguments)
      A list of arguments that will be passed to the task type run command when the task is executed.
      Parameters:
      arguments - a list of arguments for the task run command
    • setTaskData

      public void setTaskData(String taskData)
      The data to be passed to the Worker when the task is started.
      Parameters:
      taskData - the task input data
    • setEnvironment

      public void setEnvironment(Map<@NotBlank String,String> environment)
      A map containing environment variable values that will be added to the process environment when the task is executed.
      Parameters:
      environment - a map containing environment variable values
    • setStartedTime

      public void setStartedTime(Instant startedTime)
      The time the task was last started by a Worker.
      Parameters:
      startedTime - This should not be set outside of the YellowDog Scheduler service.
    • setFinishedTime

      public void setFinishedTime(Instant finishedTime)
      The time the task was finished.
      Parameters:
      finishedTime - This should not be set outside of the YellowDog Scheduler service.
    • setAbortRequestedTime

      public void setAbortRequestedTime(Instant abortRequestedTime)
      The time when task abort was requested.
      Parameters:
      abortRequestedTime - This should not be set outside of the YellowDog Scheduler service.
    • setInputs

      public void setInputs(List<@NotNull @Valid TaskInput> inputs)
      Input object specifications that determine objects to be downloaded prior to running the task.
      Parameters:
      inputs - input object specifications for the task
    • setFlattenInputPaths

      public void setFlattenInputPaths(FlattenPath flattenInputPaths)
      Indicates if the input objects' paths should be flattened when they are downloaded.
      Parameters:
      flattenInputPaths - if the input objects' paths should be flattened
    • setOutputs

      public void setOutputs(List<@NotNull @Valid TaskOutput> outputs)
      Output object specifications that determine objects to be uploaded after running the task.
      Parameters:
      outputs - output object specifications for the task
    • setData

      public void setData(TaskData data)
      Task data requirement specifications.
    • setTimeout

      public void setTimeout(Duration timeout)
      The maximum time that a worker should attempt to execute the task for before failing it.
      Parameters:
      timeout - the maximum time that a worker should attempt to execute the task for before failing it
    • setTaskGroupId

      public void setTaskGroupId(String taskGroupId)
    • setWorkerId

      public void setWorkerId(String workerId)
    • setErrors

      public void setErrors(List<TaskError> errors)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object