prefect icon indicating copy to clipboard operation
prefect copied to clipboard

Support On_cancellation state change hooks for tasks

Open masonmenges opened this issue 3 months ago • 0 comments

Describe the current behavior

Tasks currently only support on_completed and on_failed state change hooks despite them supporting a cancelling/cancelled state when their parent run is subsequently cancelled or when cancelled directly outside of a flow run context.

Describe the proposed behavior

Extend support for on_cancellation state change hooks to included cancelling/cancelled tasks.

Example Use

One common example where this might be useful would be that is allows users to cancel external jobs/processes that might have been triggered as part of a tasks execution in the context of the task that triggered the job rather than needing to do so manually or from the on_cancellation hook for a flow run which may not easily contain contextual information needed to determine which external process should be cancelled.

Additional context

No response

masonmenges avatar Oct 30 '24 19:10 masonmenges