Workflow API¶
- cloudify.workflows.workflow_api.has_cancel_request()[source]¶
Checks for requests to cancel the workflow execution. This should be used to allow graceful termination of workflow executions.
If this method is not used and acted upon, a simple ‘cancel’ request for the execution will have no effect - ‘force-cancel’ will have to be used to abruptly terminate the execution instead.
Note: When this method returns True, the workflow should make the appropriate cleanups and then it must raise an ExecutionCancelled error if the execution indeed gets cancelled (i.e. if it’s too late to cancel there is no need to raise this exception and the workflow should end normally).
- Returns:
whether there was a request to cancel the workflow execution
- cloudify.workflows.workflow_api.has_kill_request()[source]¶
Checks for requests to kill-cancel the workflow execution.
Kill-cancelling will stop the workflow process using SIGTERM, and SIGKILL after 5 seconds, so if the workflow function must attempt cleanup before it is kill-cancelled, it must install a signal to catch SIGTERM, then it can confirm using this flag whether it is being cancelled. Then it must do the necessary cleanup within the 5 seconds before the process is killed.
Note that when this is set, cancel_request will always also be set, so if no special cleanup is necessary, there is no need to check this flag.