Skip to content

Cannot run plans without a message bus (server) #426

Closed

Description

@callumforrester

Blueapi can start up without connecting to a message bus but fails to run any plans because the message bus is currently interconnected with the worker.

To Reproduce

Terminal 1

# start blueapi server
blueapi serve

Terminal 2

# Simple plan
blueapi controller run sleep '{"time": 5}'

# More complex plan
blueapi controller run count '{"detectors": ["det"]}'

Possible solution

Make the message template an optional part of the handler and make it None if connection fails. Perform None-checks on it wherever it is used. Hopefully if its type is declared as optional in all the right places mypy should point out all the usages where it is assumed to be present.

Acceptance Criteria

  • Can run the demo set of plans without connecting blueapi to a message bus
  • Tests to prove that the message bus usages are guarded

Activity

  1. added
    bug
    c: messaging
    on Apr 19, 2024
  2. changed the title [-]Cannot run plans without a message bus[/-] [+]Cannot run plans without a message bus (server)[/+] on Apr 19, 2024
  3. ZohebShaikh commented on Apr 26, 2024

    @ZohebShaikh
    Contributor

    In the Terminal 2 the example is given for the CLI which should raise exceptions when trying to run #427 (comment)
    The blueapi server can run plans without a message bus and there are already tests to check it in the test_rest_api.py it uses a handler = Handler(context=context, messaging_template=MagicMock())
    MagiMock which will run with a None as
    We can see them working by the above change in the fixture of conftest.py

    This test can be improved after we make progress on #360

    There are tests added to check if the message bus use is guarded

    The changes mentioned are in this PR: #433

  4. added a commit that references this issue on Apr 26, 2024
  5. added a commit that references this issue on May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugc: messaging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions