java.lang.Object
com.netflix.conductor.common.metadata.tasks.TaskResult

public class TaskResult extends Object
Result of the task execution.
  • Constructor Details

    • TaskResult

      public TaskResult(Task task)
    • TaskResult

      public TaskResult()
  • Method Details

    • getWorkflowInstanceId

      public String getWorkflowInstanceId()
      Returns:
      Workflow instance id for which the task result is produced
    • setWorkflowInstanceId

      public void setWorkflowInstanceId(String workflowInstanceId)
    • getTaskId

      public String getTaskId()
    • setTaskId

      public void setTaskId(String taskId)
    • getReasonForIncompletion

      public String getReasonForIncompletion()
    • setReasonForIncompletion

      public void setReasonForIncompletion(String reasonForIncompletion)
    • getCallbackAfterSeconds

      public long getCallbackAfterSeconds()
    • setCallbackAfterSeconds

      public void setCallbackAfterSeconds(long callbackAfterSeconds)
      When set to non-zero values, the task remains in the queue for the specified seconds before sent back to the worker when polled. Useful for the long running task, where the task is updated as IN_PROGRESS and should not be polled out of the queue for a specified amount of time. (delayed queue implementation)
      Parameters:
      callbackAfterSeconds - Amount of time in seconds the task should be held in the queue before giving it to a polling worker.
    • getWorkerId

      public String getWorkerId()
    • setWorkerId

      public void setWorkerId(String workerId)
      Parameters:
      workerId - a free form string identifying the worker host. Could be hostname, IP Address or any other meaningful identifier that can help identify the host/process which executed the task, in case of troubleshooting.
    • getStatus

      public TaskResult.Status getStatus()
      Returns:
      the status
    • setStatus

      public void setStatus(TaskResult.Status status)
      Parameters:
      status - Status of the task

      IN_PROGRESS: Use this for long running tasks, indicating the task is still in progress and should be checked again at a later time. e.g. the worker checks the status of the job in the DB, while the job is being executed by another process.

      FAILED, FAILED_WITH_TERMINAL_ERROR, COMPLETED: Terminal statuses for the task. Use FAILED_WITH_TERMINAL_ERROR when you do not want the task to be retried.

      See Also:
    • getOutputData

      public Map<String,Object> getOutputData()
    • setOutputData

      public void setOutputData(Map<String,Object> outputData)
      Parameters:
      outputData - output data to be set for the task execution result
    • addOutputData

      public TaskResult addOutputData(String key, Object value)
      Adds output
      Parameters:
      key - output field
      value - value
      Returns:
      current instance
    • getLogs

      public List<TaskExecLog> getLogs()
      Returns:
      Task execution logs
    • setLogs

      public void setLogs(List<TaskExecLog> logs)
      Parameters:
      logs - Task execution logs
    • log

      public TaskResult log(String log)
      Parameters:
      log - Log line to be added
      Returns:
      Instance of TaskResult
    • getExternalOutputPayloadStoragePath

      public String getExternalOutputPayloadStoragePath()
      Returns:
      the path where the task output is stored in external storage
    • setExternalOutputPayloadStoragePath

      public void setExternalOutputPayloadStoragePath(String externalOutputPayloadStoragePath)
      Parameters:
      externalOutputPayloadStoragePath - path in the external storage where the task output is stored
    • getSubWorkflowId

      public String getSubWorkflowId()
    • setSubWorkflowId

      public void setSubWorkflowId(String subWorkflowId)
    • isExtendLease

      public boolean isExtendLease()
    • setExtendLease

      public void setExtendLease(boolean extendLease)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • complete

      public static TaskResult complete()
    • failed

      public static TaskResult failed()
    • failed

      public static TaskResult failed(String failureReason)
    • inProgress

      public static TaskResult inProgress()
    • newTaskResult

      public static TaskResult newTaskResult(TaskResult.Status status)