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

Replace references to blueapi messaging package #589

Merged
merged 26 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
017b3ae
Replace references to blueapi messaging package with references to th…
callumforrester Aug 6, 2024
cbcac76
Handle connect exception in blueapi
callumforrester Aug 7, 2024
5dded50
Merge remote-tracking branch 'origin/main' into 588_remove_messaging
ZohebShaikh Aug 21, 2024
bce8081
updated to use bluesky-stomp
ZohebShaikh Aug 22, 2024
53ea6ff
updated ci to working command
ZohebShaikh Aug 23, 2024
c611740
change signature of subscribe callback
ZohebShaikh Aug 23, 2024
1dc116c
added auth to the broker constructor
ZohebShaikh Aug 27, 2024
c916777
update test and runner
ZohebShaikh Aug 27, 2024
8e0410f
stop gap commit will be removed
ZohebShaikh Aug 27, 2024
258c149
code review changes
ZohebShaikh Aug 27, 2024
594c1dc
docker container change
ZohebShaikh Aug 28, 2024
730191c
pyproject dependency fix (#607)
ZohebShaikh Aug 29, 2024
3cd7945
Handle parameterised generics (#598)
DiamondJoseph Aug 29, 2024
d42db2b
Merge branch 'main' into 588_remove_messaging
ZohebShaikh Aug 29, 2024
ec685d1
added code review changes
ZohebShaikh Aug 29, 2024
db6dcd2
removed activemq and rabbitmq from
ZohebShaikh Aug 30, 2024
8a579e7
Merge branch 'main' into 588_remove_messaging
ZohebShaikh Aug 30, 2024
b820c13
delete stomp test
ZohebShaikh Aug 30, 2024
ed41e6e
added stomp test
ZohebShaikh Sep 2, 2024
cfba6ed
added rabbitmq to CI
ZohebShaikh Sep 2, 2024
d3ab4e7
fixed typo
ZohebShaikh Sep 2, 2024
8e45cff
added mock connection
ZohebShaikh Sep 3, 2024
84b76cd
Merge remote-tracking branch 'origin/main' into 588_remove_messaging
ZohebShaikh Sep 3, 2024
3d2d53b
changed patch
ZohebShaikh Sep 3, 2024
9932702
added mock test for interface
ZohebShaikh Sep 3, 2024
7437ea5
made openapi yaml changes
ZohebShaikh Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/actions/install_requirements/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ runs:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install packages
run: pip install ${{ inputs.pip-install }}
run: pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]
shell: bash

- name: Install bluesky_stomp
run: pip install git+https://github.com/DiamondLightSource/bluesky-stomp.git@main
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
shell: bash

- name: Report what was installed
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ black==24.8.0
bluesky==1.13.0a4
bluesky-kafka==0.10.0
bluesky-live==0.0.8
bluesky-stomp @ git+https://github.com/DiamondLightSource/bluesky-stomp@4dbdb6b144b4b03243a1784f2f53dc13cbbef30e
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
boltons==24.0.0
cachetools==5.4.0
caproto==1.1.1
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"aiohttp",
"PyYAML",
"click",
"fastapi[all]",
"fastapi>=0.112.0",
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
"uvicorn",
"requests",
"dls-bluesky-core", #requires ophyd-async
Expand Down Expand Up @@ -91,7 +91,7 @@ filterwarnings = ["error", "ignore::DeprecationWarning"]
# Doctest python code in docs, python code in src docstrings, test functions in tests
testpaths = "docs src tests"
markers = [
"handler: marks tests that interact with the global handler object in handler.py",
"stomp: marks tests that require the stomp"
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
]
asyncio_mode = "auto"

Expand Down
8 changes: 5 additions & 3 deletions src/blueapi/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import click
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky_stomp.messaging import MessageContext, MessagingTemplate
from bluesky_stomp.models import Broker
from pydantic import ValidationError
from requests.exceptions import ConnectionError

Expand All @@ -16,8 +18,6 @@
from blueapi.client.rest import BlueskyRemoteControlError
from blueapi.config import ApplicationConfig, ConfigLoader
from blueapi.core import DataEvent
from blueapi.messaging import MessageContext
from blueapi.messaging.stomptemplate import StompMessagingTemplate
from blueapi.service.main import start
from blueapi.service.openapi import (
DOCS_SCHEMA_LOCATION,
Expand Down Expand Up @@ -147,7 +147,9 @@ def listen_to_events(obj: dict) -> None:
config: ApplicationConfig = obj["config"]
if config.stomp is not None:
event_bus_client = EventBusClient(
StompMessagingTemplate.autoconfigured(config.stomp)
MessagingTemplate.for_broker(
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
broker=Broker(host=config.stomp.host, port=config.stomp.port, auth=None)
)
)
else:
raise RuntimeError("Message bus needs to be configured")
Expand Down
8 changes: 6 additions & 2 deletions src/blueapi/client/client.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import time
from concurrent.futures import Future

from bluesky_stomp.messaging import MessageContext, MessagingTemplate
from bluesky_stomp.models import Broker

from blueapi.config import ApplicationConfig
from blueapi.core.bluesky_types import DataEvent
from blueapi.messaging import MessageContext, StompMessagingTemplate
from blueapi.service.model import (
DeviceModel,
DeviceResponse,
Expand Down Expand Up @@ -38,7 +40,9 @@ def __init__(
def from_config(cls, config: ApplicationConfig) -> "BlueapiClient":
rest = BlueapiRestClient(config.api)
if config.stomp is not None:
template = StompMessagingTemplate.autoconfigured(config.stomp)
template = MessagingTemplate.for_broker(
broker=Broker(host=config.stomp.host, port=config.stomp.port, auth=None)
)
events = EventBusClient(template)
else:
events = None
Expand Down
6 changes: 4 additions & 2 deletions src/blueapi/client/event_bus.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from collections.abc import Callable

from bluesky_stomp.messaging import MessageContext, MessagingTemplate
from bluesky_stomp.models import MessageQueue

from blueapi.core import DataEvent
from blueapi.messaging import MessageContext, MessagingTemplate
from blueapi.worker import ProgressEvent, WorkerEvent


Expand Down Expand Up @@ -32,7 +34,7 @@ def subscribe_to_all_events(
) -> None:
try:
self.app.subscribe(
self.app.destinations.topic("public.worker.event"),
MessageQueue(name="public.worker.event"),
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
ZohebShaikh marked this conversation as resolved.
Show resolved Hide resolved
on_event,
)
except Exception as err:
Expand Down
12 changes: 0 additions & 12 deletions src/blueapi/messaging/__init__.py

This file was deleted.

196 changes: 0 additions & 196 deletions src/blueapi/messaging/base.py

This file was deleted.

12 changes: 0 additions & 12 deletions src/blueapi/messaging/context.py

This file was deleted.

Loading
Loading