-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When trying to use BlueapiClient, I ran into an issue with plans running but never returning. The setup is below:
>>> from blueapi.client import BlueapiClient
>>> bc = BlueapiClient.from_config_file("/home/xol73553/Documents/BLUESKY/i09_blueapi_client_config.yaml")
>>> for device in bc.devices:
... print(device)
...
<Response [200]>
dcm
lakeshore
psi2
psj2
psi1
psk1
fsj1
psj1
jphase
pgm
jgap
iid
ienergy_order
fsi1
source_selector
synchrotron
smpm
iidenergy
jid
ienergy
dual_fast_shutter
dual_energy_source
jidcontroller
jpolarisation
ew4000
jidenergy
jenergy
>>> devices = bc.devices
>>> plans = bc.plans
<Response [200]>Then when trying to run a simple move plan:
>>> plans.move({devices.fsj1: "Out"})
<Response [201]>
<Response [200]>
it successfully moves the shutter. However, it is still forever running and blocking so I'm unable to run any more plans. In the logs, I can see the following in BlueAPI for i09
[11:59 AM]2026-03-20 11:57:34,051 INFO blueapi.worker.task_worker Submitting: task_id='4fa02cbf-1794-45b5-9232-4c29fd32345b' task=Task(name='move', params={'moves': {'fsj1': 'Out'}}, metadata={'user': 'xol73553', 'instrument_session': 'cm12345-1'}) request_id=None is_complete=False is_pending=True errors=[] outcome=None
2026-03-20 11:57:34,052 INFO blueapi.worker.task_worker Got new task: task_id='4fa02cbf-1794-45b5-9232-4c29fd32345b' task=Task(name='move', params={'moves': {'fsj1': 'Out'}}, metadata={'user': 'xol73553', 'instrument_session': 'cm12345-1'}) request_id=None is_complete=False is_pending=True errors=[] outcome=None
2026-03-20 11:57:34,052 INFO blueapi.worker.task Asked to run plan move with {'moves': {'fsj1': 'Out'}} and metadata {'user': 'xol73553', 'instrument_session': 'cm12345-1'} for all runs
2026-03-20 11:57:34,052 INFO bluesky Executing plan <generator object move at 0x7fc9bb3db100>
2026-03-20 11:57:34,053 INFO bluesky.RE.state Change state on <bluesky.run_engine.RunEngine object at 0x7fc9c0de66d0> from 'idle' -> 'running'
2026-03-20 11:57:34,065 INFO blueapi.service.main 10.36.0.21:60270 PUT /worker/task 200
2026-03-20 11:57:34,136 INFO bluesky.RE.state Change state on <bluesky.run_engine.RunEngine object at 0x7fc9c0de66d0> from 'running' -> 'idle'
2026-03-20 11:57:34,137 INFO bluesky Cleaned up from plan <generator object move at 0x7fc9bb3db100>
2026-03-20 11:57:34,137 INFO blueapi.worker.task_worker Task ran successfully - returned: (<AsyncStatus, device: fsj1, task: <coroutine object AsyncStatusBase.__init__.<locals>.wait_with_error_message at 0x7fc9bb104340>, done>,)
2026-03-20 11:57:34,140 ERROR blueapi.worker.task_worker Type is not JSON serializable: AsyncStatus
TypeError: Type <class 'ophyd_async.core._status.AsyncStatus'> not serializable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.11/site-packages/blueapi/worker/task_worker.py", line 424, in _cycle_with_error_handling
self._cycle()
File "/app/.venv/lib/python3.11/site-packages/observability_utils/tracing/decorators.py", line 151, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/blueapi/worker/task_worker.py", line 485, in _cycle
self._report_status()
File "/app/.venv/lib/python3.11/site-packages/observability_utils/tracing/decorators.py", line 151, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/blueapi/worker/task_worker.py", line 570, in _report_status
self._worker_events.publish(event, correlation_id)
File "/app/.venv/lib/python3.11/site-packages/blueapi/core/event.py", line 80, in publish
callback(event, correlation_id)
File "/app/.venv/lib/python3.11/site-packages/blueapi/service/interface.py", line 121, in forward_message
stomp_client_ref.send(
File "/app/.venv/lib/python3.11/site-packages/bluesky_stomp/messaging.py", line 213, in send
serialized_message = self._serializer(obj)
^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.11/site-packages/bluesky_stomp/serdes.py", line 35, in serialize_message
return orjson.dumps(
^^^^^^^^^^^^^
TypeError: Type is not JSON serializable: AsyncStatus
2026-03-20 11:57:34,141 INFO blueapi.worker.task_worker Awaiting task
So it seems to be trying to serialise the AsyncStatus and then fails as this isn't serializable.
Acceptance Criteria
- Plan runs successfully, doesn't block once finished.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working