Skip to content

Commit

Permalink
ENH: reserve kernel only if IPython kernel is used
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgav committed Mar 14, 2024
1 parent 24ba039 commit 4116a8f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bluesky_queueserver/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,13 +1471,18 @@ async def _worker_command_confirm_exit(self):

async def _worker_command_reserve_kernel(self):
"""
Initiate stopping the execution loop. Call fails if the worker is running on Python
(not IPython kernel).
Reserve the kernel (start execution loop in the kernel) if the worker is
running IPython kernel. Return ``True`` if the worker is not using IPython
kernel (execution loop is continuously running in this case, so the 'kernel'
can always be considered reserved).
"""
try:
response = await self._comm_to_worker.send_msg("command_reserve_kernel")
success = response["status"] == "accepted"
err_msg = response["err_msg"]
if self._use_ipython_kernel:
response = await self._comm_to_worker.send_msg("command_reserve_kernel")
success = response["status"] == "accepted"
err_msg = response["err_msg"]
else:
success, err_msg = True, ""
except CommTimeoutError:
success, err_msg = None, "Timeout occurred while processing the request"
return success, err_msg
Expand Down

0 comments on commit 4116a8f

Please sign in to comment.