Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
callumforrester opened this issue Apr 19, 2024 · 1 comment · Fixed by #433
Closed

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

callumforrester opened this issue Apr 19, 2024 · 1 comment · Fixed by #433
Labels
bug Something isn't working messaging Relates to asynchronous messaging code

Comments

@callumforrester
Copy link
Collaborator

callumforrester commented Apr 19, 2024

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
@callumforrester callumforrester added bug Something isn't working messaging Relates to asynchronous messaging code labels Apr 19, 2024
@callumforrester callumforrester changed the title Cannot run plans without a message bus Cannot run plans without a message bus (server) Apr 19, 2024
@ZohebShaikh
Copy link
Collaborator

ZohebShaikh commented Apr 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working messaging Relates to asynchronous messaging code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants