bluesky_queueserver_api.zmq.REManagerAPI.kernel_interrupt

REManagerAPI.kernel_interrupt(*, interrupt_task=None, interrupt_plan=None, lock_key=None)

Send interrupt request (Ctrl-C) to the running IPython kernel. The API call fails if IPython mode is not enabled or environment does not exist (there is no IPython kernel). The API is primarily intended to interrupt tasks started by clients connected directly to IPython kernel (such as Jupyter Console) and by default it fails if the manager is executing a plan or a task. Set the interrupt_task and/or interrupt_plan parameters True in order to be able to interrupt a running foreground task or a plan (single interrupt initiates deferred pause, two consecutive interrupts initiate immediate pause). Note, that re_pause API is more reliable method of pausing the plan.

Parameters:
interrupt_task: boolean (optional, default False)

Allow the API request to interrupt a task started by RE Manager.

interrupt_plan: boolean (optional, default False)

Allow the API request to interrupt a running plan (started by RE Manager or directly via Jupyter Console).

lock_key: str or None (optional)

The lock key enables access to the API when RE Manager environment is locked. If the parameter is not None, the key overrides the current lock key set by REManagerAPI.lock_key. See documentation on REMangerAPI.lock() for more information. Default: None.

Returns:
response: dict

Dictionary keys:

  • success: boolean - success of the request.

  • msg: str - error message in case the request is rejected by RE Manager or operation failed.

Raises:
RequestTimeoutError, RequestFailedError, HTTPRequestError, HTTPClientError, HTTPServerError

All exceptions raised by send_request API.

Examples

# Synchronous code (0MQ, HTTP)
RM.kernel_interrupt()

# Asynchronous code (0MQ, HTTP)
await RM.kernel_interrupt()