yade_interrupt_task
Cancel a queued or interrupt a running YADE simulation task. Uses a graceful interrupt flag and optionally injects a TaskInterrupt exception to break deadlocks.
Instructions
Stop a running YADE task, or cancel one still waiting in the queue.
A task that has not started yet is simply removed from the queue
and ends in status canceled (method reports
canceled_while_queued). For a running task, two cancellation
paths are applied together by the bridge:
flag_only— sets an interrupt flag that YADE's PyRunner tick observes between simulation iterations (graceful path forO.runtasks).flag_and_async_exc— in addition, injects aTaskInterruptexception into the script thread, so pure-Python deadloops with noO.runon the stack are terminated too.
The response method field reports which path ran. When
async-exc is refused (e.g. target thread is a Dummy-N
boost::python frame), async_exc_skipped_reason explains why.
Namespace after interrupt: the YADE __main__ namespace is
shared between tasks and yade_execute_code calls. Any
variables the interrupted script had already defined —
including O state — are preserved. There's no need to
re-run the whole script to continue work: inspect state with
yade_execute_code or resume via a fresh yade_execute_task
that only runs the remaining logic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | Task ID returned by yade_execute_task |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||