{"_id":"55ed88ba2e66b621009941ab","__v":5,"githubsync":"","project":"55e94ebde5d0c623003ed868","category":{"_id":"55e94ebee5d0c623003ed86c","pages":["55e94ebfe5d0c623003ed86e","55ed7fdadf21af2b009e217d","55ed86db2e66b621009941a6","55ed879428d7c33700de00e1","55ed88392e66b621009941a9","55ed885cec4c3e3900b75611","55ed88ba2e66b621009941ab","55ed8caba872a80d00acff5d","55ed8ce82e66b621009941c3","560d5df697a0a32f006e9de9","566ff8f33a32d20d00c45b37","5670195e81801f0d00802e1c"],"version":"55e94ebee5d0c623003ed86b","__v":12,"project":"55e94ebde5d0c623003ed868","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-04T07:56:46.830Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"version":{"_id":"55e94ebee5d0c623003ed86b","project":"55e94ebde5d0c623003ed868","__v":1,"createdAt":"2015-09-04T07:56:46.272Z","releaseDate":"2015-09-04T07:56:46.272Z","categories":["55e94ebee5d0c623003ed86c"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.3.0","version":"0.3.0"},"user":"55e94db887e942230032e40d","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-07T12:53:14.584Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"The typical lifecycle of a Task comprises:\n\n  *     **waiting**: Task is waiting for a worker\n  *     **running**: Task is running on one executor node\n  *     **finished**: Task execution finished with no \"error\"\n  *     **error**: Task execution finished throwing an \"error\"\n  \nEvery task start from the **waiting ** status, possible transitions are:\n\n  *     **waiting **-> **running**  when the task is assignedd to a worker\n  *     **running **-> **waiting**  when an attempt failed and the task is scheduled again\n  *     **running **-> **error** when an error occours and recovery ccannot bee performed\n  *     **running **-> **finished** when the execution terminated normally\n\nErrors are of two types:\n\n  *     exception during the execution\n  *     crash of the worker which is executing the task\n\nUpon any error the task gets re-scheduled if 'deadline' and 'maxattempts' rules allow such recovery (see [Task Properties](doc:task-properties) ).\n\nUsually execution of tasks encounter two kinds of \"failures\", recoverable failures and unrecoverable failures,\nIf 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.\n \nUsually when the Worker proceeds with a clean shoutdown it interrupts every worker thread in order to signal that the system is shutting down.","excerpt":"","slug":"task-life-cycle","type":"basic","title":"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](doc: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.