Class Execution

java.lang.Object
io.kestra.core.models.executions.Execution
All Implemented Interfaces:
DeletedInterface, TenantInterface

public class Execution extends Object implements DeletedInterface, TenantInterface
  • Constructor Details

    • Execution

      public Execution()
  • Method Details

    • builder

      public static Execution.ExecutionBuilder builder()
    • withState

      public Execution withState(State.Type state)
    • withTaskRun

      public Execution withTaskRun(TaskRun taskRun) throws InternalException
      Throws:
      InternalException
    • childExecution

      public Execution childExecution(String childExecutionId, List<TaskRun> taskRunList, State state)
    • findTaskRunsByTaskId

      public List<TaskRun> findTaskRunsByTaskId(String id)
    • findTaskRunByTaskRunId

      public TaskRun findTaskRunByTaskRunId(String id) throws InternalException
      Throws:
      InternalException
    • findTaskRunByTaskIdAndValue

      public TaskRun findTaskRunByTaskIdAndValue(String id, List<String> values) throws InternalException
      Throws:
      InternalException
    • findTaskDependingFlowState

      public List<ResolvedTask> findTaskDependingFlowState(List<ResolvedTask> resolvedTasks, List<ResolvedTask> resolvedErrors)
      Determine if the current execution is on error & normal tasks Used only from the flow
      Parameters:
      resolvedTasks - normal tasks
      resolvedErrors - errors tasks
      Returns:
      the flow we need to follow
    • findTaskDependingFlowState

      public List<ResolvedTask> findTaskDependingFlowState(List<ResolvedTask> resolvedTasks, @Nullable List<ResolvedTask> resolvedErrors, TaskRun parentTaskRun)
      Determine if the current execution is on error & normal tasks

      if the current have errors, return tasks from errors if not, return the normal tasks

      Parameters:
      resolvedTasks - normal tasks
      resolvedErrors - errors tasks
      parentTaskRun - the parent task
      Returns:
      the flow we need to follow
    • findTaskDependingFlowState

      public List<ResolvedTask> findTaskDependingFlowState(List<ResolvedTask> resolvedTasks)
    • findTaskRunByTasks

      public List<TaskRun> findTaskRunByTasks(List<ResolvedTask> resolvedTasks, TaskRun parentTaskRun)
    • findFirstByState

      public Optional<TaskRun> findFirstByState(State.Type state)
    • findFirstRunning

      public Optional<TaskRun> findFirstRunning()
    • findLastNotTerminated

      public Optional<TaskRun> findLastNotTerminated()
    • findLastByState

      public Optional<TaskRun> findLastByState(List<TaskRun> taskRuns, State.Type state)
    • findLastCreated

      public Optional<TaskRun> findLastCreated(List<TaskRun> taskRuns)
    • findLastRunning

      public Optional<TaskRun> findLastRunning(List<TaskRun> taskRuns)
    • findLastTerminated

      public Optional<TaskRun> findLastTerminated(List<TaskRun> taskRuns)
    • isTerminated

      public boolean isTerminated(List<ResolvedTask> resolvedTasks)
    • isTerminated

      public boolean isTerminated(List<ResolvedTask> resolvedTasks, TaskRun parentTaskRun)
    • hasWarning

      public boolean hasWarning()
    • hasWarning

      public boolean hasWarning(List<ResolvedTask> resolvedTasks)
    • hasWarning

      public boolean hasWarning(List<ResolvedTask> resolvedTasks, TaskRun parentTaskRun)
    • hasFailed

      public boolean hasFailed()
    • hasFailed

      public boolean hasFailed(List<ResolvedTask> resolvedTasks)
    • hasFailed

      public boolean hasFailed(List<ResolvedTask> resolvedTasks, TaskRun parentTaskRun)
    • hasCreated

      public boolean hasCreated()
    • hasCreated

      public boolean hasCreated(List<ResolvedTask> resolvedTasks)
    • hasCreated

      public boolean hasCreated(List<ResolvedTask> resolvedTasks, TaskRun parentTaskRun)
    • hasRunning

      public boolean hasRunning(List<ResolvedTask> resolvedTasks)
    • hasRunning

      public boolean hasRunning(List<ResolvedTask> resolvedTasks, TaskRun parentTaskRun)
    • guessFinalState

      public State.Type guessFinalState(Flow flow)
    • guessFinalState

      public State.Type guessFinalState(List<ResolvedTask> currentTasks, TaskRun parentTaskRun)
    • hasTaskRunJoinable

      public boolean hasTaskRunJoinable(TaskRun taskRun)
    • failedExecutionFromExecutor

      public Execution.FailedExecutionWithLog failedExecutionFromExecutor(Exception e)
      Convert an exception on Executor and add log to the current RUNNING taskRun, on the lastAttempts. If no Attempt is found, we create one (must be nominal case). The executor will catch the FAILED taskRun emitted and will failed the execution. In the worst case, we FAILED the execution (only from Flow).
      Parameters:
      e - the exception throw from Executor
      Returns:
      a new execution with taskrun failed if possible or execution failed is other case
    • loggingEventFromException

      public static ch.qos.logback.classic.spi.ILoggingEvent loggingEventFromException(Exception e)
      Transform an exception to ILoggingEvent
      Parameters:
      e - the current execption
      Returns:
      the ILoggingEvent waited to generate LogEntry
    • outputs

      public Map<String,Object> outputs()
    • parents

      public List<Map<String,Object>> parents(TaskRun taskRun)
    • findChilds

      public List<TaskRun> findChilds(TaskRun taskRun)
      Find all children from this TaskRun. The list is starting from deeper child and end on closest child, so first element is the task that start first. This method don't return the current tasks
      Parameters:
      taskRun - current child
      Returns:
      List of parent TaskRun
    • findChildsValues

      public List<String> findChildsValues(TaskRun taskRun, boolean withCurrent)
    • toDeleted

      public Execution toDeleted()
    • toString

      public String toString(boolean pretty)
    • toStringState

      public String toStringState()
    • toCrc32State

      public Long toCrc32State()