ray.runtime_context.RuntimeContext.is_canceled#
- RuntimeContext.is_canceled() bool[source]#
Check if the current task has been canceled.
This can be used to periodically check if ray.cancel() has been called on the current task and perform graceful cleanup.
- Returns:
True if the task has been canceled, False otherwise.
- Raises:
RuntimeError – If called from a driver or async actor context.