Task Lifecycle

The typical lifecycle of a Task comprises:

  • **waiting**: Task is waiting for a worker
    
  • **running**: Task is running on one executor node
    
  • **finished**: Task execution finished with no "error"
    
  • **error**: Task execution finished throwing an "error"
    

Every task start from the waiting status, possible transitions are:

  • **waiting **-> **running**  when the task is assignedd to a worker
    
  • **running **-> **waiting**  when an attempt failed and the task is scheduled again
    
  • **running **-> **error** when an error occours and recovery ccannot bee performed
    
  • **running **-> **finished** when the execution terminated normally
    

Errors are of two types:

  • exception during the execution
    
  • crash of the worker which is executing the task
    

Upon any error the task gets re-scheduled if 'deadline' and 'maxattempts' rules allow such recovery (see Task Properties ).

Usually execution of tasks encounter two kinds of "failures", recoverable failures and unrecoverable failures,
If the TaskExecutor (the code which implements the task) throws any Java Exception (both checked and unchecked) the broker will try to reccover the task scheduling a new attempt. If the task encounter a "definitive" failure it must return from the "execute" method without throwing any Exception.

Usually when the Worker proceeds with a clean shoutdown it interrupts every worker thread in order to signal that the system is shutting down.


Did this page help you?