All docs
Context·
property
StepContext.cancelled
true once cancellation is requested for this run
Python
cancelled: bool
Returns bool — True once the user requested cancellation of this run
Example#
Python
@tool.shape
def heavy(t: Table, ctx: StepContext) -> Table:
for chunk in chunks(t):
if ctx.cancelled:
return t # stop early, cleanly
...
return t
Notes#
Read-only. Poll it inside long loops — nothing interrupts your function for you. Returning early on cancel leaves whatever partial work you have done, so return a safe value.
See also#
API: progress · step_id · StepContext
Guides: Parameters vs ports
By LSD Team · Last updated Jul 17, 2026
Ask on Discord
View as Markdown