yade_interrupt_task
Interrupt a running YADE task: sets an interrupt flag and optionally injects a TaskInterrupt exception to terminate deadloops. Preserves the namespace for later inspection.
Instructions
Request interruption of a running YADE 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 | |||