You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking into how this works in bluesky, it looks like plan_result is available on a returned RunEngineResult rather than on the run engine and only then if the run_engine is configured to return a result.
We are not currently setting call_returns_result but as far as I can see, we're not using the returned plan UUIDs either so it shouldn't break anything to set it now.
Not sure how to handle the case where a plan returns something that isn't JSON serializable. Is returning None an option? An error message (that risks being a confusion if a plan returns a string)? Wrap everything in new wrapper types?
Will add a proof-of-concept PR that returns results in the task_status of the WorkerEvent that is sent when the plan completes and crashes the server if it's not serializable.
This may all be changing (soon?) if we move away from using the message bus (see #1326). In that scenario, we probably wouldn't have WorkerEvents and the final event sent over the stream could be the plan result.
The problem with having the TaskResult/UnserializableResult types is that we don't know ahead of time that a type isn't serializable. The serialization is done in another library (albeit a DLS one (bluesky-stomp)) with some customisation so we can't realistically try serialising and see what happens.
We could potentially limit return types to pydantic models + python builtins? Anything that pydantic can create a TypeAdapter from?
We could potentially limit return types to pydantic models + python builtins? Anything that pydantic can create a TypeAdapter from?
Yh, this is fine. I would even be tempted to limit this to just builtins. I really envisaged this "feature" as a bit of a stop gap, to get some basic data out of bluesky. If you're trying to return complex types then you should be using other mechanisms (e.g. the event stream)
Activity
tpoliaw commentedon Jan 27, 2026
Looking into how this works in bluesky, it looks like
plan_resultis available on a returnedRunEngineResultrather than on the run engine and only then if the run_engine is configured to return a result.We are not currently setting
call_returns_resultbut as far as I can see, we're not using the returned plan UUIDs either so it shouldn't break anything to set it now.tpoliaw commentedon Jan 27, 2026
Not sure how to handle the case where a plan returns something that isn't JSON serializable. Is returning
Nonean option? An error message (that risks being a confusion if a plan returns a string)? Wrap everything in new wrapper types?tpoliaw commentedon Jan 27, 2026
Will add a proof-of-concept PR that returns results in the
task_statusof theWorkerEventthat is sent when the plan completes and crashes the server if it's not serializable.WIP returning results from plans
tpoliaw commentedon Jan 27, 2026
This may all be changing (soon?) if we move away from using the message bus (see #1326). In that scenario, we probably wouldn't have
WorkerEventsand the final event sent over the stream could be the plan result.tpoliaw commentedon Jan 28, 2026
The problem with having the
TaskResult/UnserializableResulttypes is that we don't know ahead of time that a type isn't serializable. The serialization is done in another library (albeit a DLS one (bluesky-stomp)) with some customisation so we can't realistically try serialising and see what happens.We could potentially limit return types to pydantic models + python builtins? Anything that pydantic can create a
TypeAdapterfrom?DominicOram commentedon Jan 28, 2026
I think this is fine.
Yh, this is fine. I would even be tempted to limit this to just builtins. I really envisaged this "feature" as a bit of a stop gap, to get some basic data out of bluesky. If you're trying to return complex types then you should be using other mechanisms (e.g. the event stream)