Skip to content

Plans do not function with *args #1450

@EmsArnold

Description

@EmsArnold

Currently plans with *args do not function as expected.

A plan which broadly looks like:

def test_move(*args: Movable[T] | T, group: Group | None = None) -> MsgGenerator:
    return (yield from bps.mv(*args, group=group))

and is run from the client:

plans = bc.plans
plans.test_move(devices.sample_stage.x, "0")

you receive the following error:

2026-03-23 14:07:13,012     INFO blueapi.worker.task_worker Submitting: task_id='b3744ab9-b5a6-4846-ad06-060ba635a87c' task=Task(name='test_move', params={'args': 'sample_stage.x', 'group': '0'}, metadata={'user': 'vgz78127', 'instrument_session': 'cm44191-1', 'tiled_access_tags': ['{"proposal": 44191, "visit": 1, "beamline": "b01-1"}']}) request_id=None is_complete=False is_pending=True errors=[] outcome=None
2026-03-23 14:07:13,013     INFO blueapi.worker.task_worker Got new task: task_id='b3744ab9-b5a6-4846-ad06-060ba635a87c' task=Task(name='test_move', params={'args': 'sample_stage.x', 'group': '0'}, metadata={'user': 'vgz78127', 'instrument_session': 'cm44191-1', 'tiled_access_tags': ['{"proposal": 44191, "visit": 1, "beamline": "b01-1"}']}) request_id=None is_complete=False is_pending=True errors=[] outcome=None
2026-03-23 14:07:13,013     INFO blueapi.worker.task Asked to run plan test_move with {'args': 'sample_stage.x', 'group': '0'} and metadata {'user': 'vgz78127', 'instrument_session': 'cm44191-1', 'tiled_access_tags': ['{"proposal": 44191, "visit": 1, "beamline": "b01-1"}']} for all runs
2026-03-23 14:07:13,014    ERROR blueapi.worker.task_worker Task failed
2026-03-23 14:07:13,014    ERROR blueapi.worker.task_worker test_move() got an unexpected keyword argument 'args'
Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/blueapi/worker/task_worker.py", line 441, in process_task
    result = self._current.task.do_task(self._ctx)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/blueapi/worker/task.py", line 41, in do_task
    result = ctx.run_engine(func(**prepared_params))
                            ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: test_move() got an unexpected keyword argument 'args'

If run from the client in a slightly different manner, e.g. plans.test_move(devices.sample_stage.x, 0) or plans.test_move(devices.sample_stage.x, 0, group = "foo"), you receive a blueapi.client.rest.InvalidParametersError with slightly differing flavours.

This causes some of the plans (such as move to have syntax which is significantly different from that of the underlying bluesky plan.

These wrapped plans and plan_stubs were originally written by @DiamondJoseph in #793, and the only mention of *args is that they shall not be used for plans and plan_stubs.

Acceptance Criteria

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions