Skip to content

Commit

Permalink
Update bluesky-stomp and prevent duplication of BasicAuthentication (#…
Browse files Browse the repository at this point in the history
…640)

Fixes #636
  • Loading branch information
DiamondJoseph committed Sep 17, 2024
1 parent 9d7414b commit 8b35390
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 130 deletions.
58 changes: 29 additions & 29 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bidict==0.23.1
bluesky==1.13.0a4
bluesky-kafka==0.10.0
bluesky-live==0.0.8
bluesky-stomp==0.1.0
bluesky-stomp==0.1.2
boltons==24.0.0
bump-pydantic==0.8.0
cachetools==5.5.0
Expand All @@ -37,14 +37,14 @@ contourpy==1.3.0
copier==9.3.1
coverage==7.6.1
cycler==0.12.1
dask==2024.8.2
dask==2024.9.0
databroker==1.2.5
dataclasses-json==0.6.7
decorator==5.1.1
deepmerge==2.0
distlib==0.3.8
dls-bluesky-core==0.0.4
dls-dodal==1.31.0
dls-dodal==1.31.1
dnspython==2.6.1
docopt==0.6.2
doct==1.1.0
Expand All @@ -56,10 +56,10 @@ epicscorelibs==7.0.7.99.0.2
event-model==1.21.0
exceptiongroup==1.2.2
executing==2.1.0
fastapi==0.113.0
fastapi==0.114.2
fastapi-cli==0.0.5
fasteners==0.19
filelock==3.15.4
filelock==3.16.0
flexcache==0.3
flexparser==0.3.1
fonttools==4.53.1
Expand All @@ -77,12 +77,12 @@ httpcore==1.0.5
httptools==0.6.1
httpx==0.27.2
humanize==4.10.0
identify==2.6.0
idna==3.8
identify==2.6.1
idna==3.10
imageio==2.35.1
imagesize==1.4.1
importlib_metadata==8.4.0
importlib_resources==6.4.4
importlib_metadata==8.5.0
importlib_resources==6.4.5
iniconfig==2.0.0
intake==0.6.4
ipython==8.18.0
Expand All @@ -105,14 +105,14 @@ MarkupSafe==2.1.5
marshmallow==3.22.0
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.1
mdit-py-plugins==0.4.2
mdurl==0.1.2
mistune==3.0.2
mock==5.1.0
mongoquery==1.4.2
msgpack==1.0.8
msgpack==1.1.0
msgpack-numpy==0.4.8
multidict==6.0.5
multidict==6.1.0
mypy==1.11.2
mypy-extensions==1.0.0
myst-parser==4.0.0
Expand All @@ -139,8 +139,8 @@ pika==1.3.2
pillow==10.4.0
PIMS==0.7
Pint==0.24.3
pipdeptree==2.23.1
platformdirs==4.2.2
pipdeptree==2.23.3
platformdirs==4.3.3
pluggy==1.5.0
plumbum==1.8.3
ply==3.11
Expand All @@ -152,26 +152,26 @@ ptyprocess==0.7.0
pure_eval==0.2.3
pvxslibs==1.3.1
py==1.11.0
pyasn1==0.6.0
pyasn1==0.6.1
pycryptodome==3.20.0
pydantic==2.9.0
pydantic==2.9.1
pydantic-extra-types==2.9.0
pydantic-settings==2.4.0
pydantic_core==2.23.2
pydantic-settings==2.5.2
pydantic_core==2.23.3
pydantic_numpy==5.0.2
pydata-sphinx-theme==0.15.4
pyepics==3.5.7
Pygments==2.18.0
pymongo==4.8.0
pyOlog==4.5.0
pyparsing==3.1.4
pytest==8.3.2
pytest==8.3.3
pytest-asyncio==0.24.0
pytest-cov==5.0.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
pytz==2024.1
pytz==2024.2
PyYAML==6.0.2
pyyaml-include==2.1
questionary==2.0.1
Expand All @@ -184,7 +184,7 @@ rich==13.7.1
rpds-py==0.20.0
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
ruff==0.6.4
ruff==0.6.5
scanspec==0.7.2
semver==3.0.2
setuptools-dso==2.11
Expand All @@ -210,7 +210,7 @@ sphinxcontrib-openapi==0.8.4
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
starlette==0.38.4
starlette==0.38.5
stomp-py==8.1.2
suitcase-mongo==0.6.0
suitcase-msgpack==0.3.0
Expand All @@ -226,27 +226,27 @@ tqdm==4.66.5
traitlets==5.14.3
typer==0.12.4
types-mock==5.1.0.20240425
types-PyYAML==6.0.12.20240808
types-requests==2.32.0.20240905
types-PyYAML==6.0.12.20240917
types-requests==2.32.0.20240914
types-urllib3==1.26.25.14
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
tzlocal==5.2
ujson==5.10.0
urllib3==2.2.2
urllib3==2.2.3
uvicorn==0.30.6
uvloop==0.19.0
virtualenv==20.26.3
virtualenv==20.26.4
watchfiles==0.24.0
wcwidth==0.2.13
websocket-client==1.8.0
websockets==13.0.1
widgetsnbextension==4.0.13
workflows==2.27
xarray==2024.7.0
yarl==1.9.11
xarray==2024.9.0
yarl==1.11.1
zarr==2.18.3
zict==2.2.0
zipp==3.20.1
zipp==3.20.2
zocalo==1.1.0
89 changes: 42 additions & 47 deletions helm/blueapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ serviceAccount:

podAnnotations: {}

podSecurityContext:
{}
# fsGroup: 2000

securityContext:
{}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

# Recommended for production to change service.type to ClusterIP and set up an Ingress
service:
Expand All @@ -47,23 +45,21 @@ ingress:
create: false
# host: foo.diamond.ac.uk (assumes port = service.port)

resources:
{}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

initResources:
{}
# Can optionally specify separate resource constraints for the scratch setup container.
# If left empty this defaults to the same as resources above.
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

initResources: {}
# Can optionally specify separate resource constraints for the scratch setup container.
# If left empty this defaults to the same as resources above.

nodeSelector: {}

Expand All @@ -80,13 +76,12 @@ listener:
resources: {}

# Additional envVars to mount to the pod as a String
extraEnvVars:
[]
# - name: RABBITMQ_PASSWORD
# valueFrom:
# secretKeyRef:
# name: rabbitmq-password
# key: rabbitmq-password
extraEnvVars: []
# - name: RABBITMQ_PASSWORD
# valueFrom:
# secretKeyRef:
# name: rabbitmq-password
# key: rabbitmq-password

# Config for the worker goes here, will be mounted into a config file
worker:
Expand All @@ -95,27 +90,27 @@ worker:
port: 8000
env:
sources:
- kind: deviceFunctions
module: blueapi.startup.example_devices
- kind: planFunctions
module: blueapi.startup.example_plans
- kind: planFunctions
module: dls_bluesky_core.plans
- kind: planFunctions
module: dls_bluesky_core.stubs
- kind: deviceFunctions
module: blueapi.startup.example_devices
- kind: planFunctions
module: blueapi.startup.example_plans
- kind: planFunctions
module: dls_bluesky_core.plans
- kind: planFunctions
module: dls_bluesky_core.stubs
stomp:
auth:
username: guest
passcode: guest
password: guest
host: rabbitmq
port: 61613

initContainer:
scratch:
root: /blueapi-plugins/scratch
repositories: []
# - name: "dodal"
# remote_url: https://github.com/DiamondLightSource/dodal.git
# - name: "dodal"
# remote_url: https://github.com/DiamondLightSource/dodal.git

# Mount path for scratch area from host machine, setting
# this effectively enables scratch area management
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [
"dls-dodal>=1.31.0",
"super-state-machine", # See GH issue 553
"GitPython",
"bluesky-stomp>=0.1.0",
"bluesky-stomp>=0.1.2",
]
dynamic = ["version"]
license.file = "LICENSE"
Expand Down
4 changes: 2 additions & 2 deletions src/blueapi/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import click
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky_stomp.messaging import MessageContext, MessagingTemplate
from bluesky_stomp.messaging import MessageContext, StompClient
from bluesky_stomp.models import Broker
from pydantic import ValidationError
from requests.exceptions import ConnectionError
Expand Down Expand Up @@ -148,7 +148,7 @@ def listen_to_events(obj: dict) -> None:
config: ApplicationConfig = obj["config"]
if config.stomp is not None:
event_bus_client = EventBusClient(
MessagingTemplate.for_broker(
StompClient.for_broker(
broker=Broker(
host=config.stomp.host,
port=config.stomp.port,
Expand Down
4 changes: 2 additions & 2 deletions src/blueapi/client/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import time
from concurrent.futures import Future

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

from blueapi.config import ApplicationConfig
Expand Down Expand Up @@ -41,7 +41,7 @@ def __init__(
def from_config(cls, config: ApplicationConfig) -> "BlueapiClient":
rest = BlueapiRestClient(config.api)
if config.stomp is not None:
template = MessagingTemplate.for_broker(
template = StompClient.for_broker(
broker=Broker(
host=config.stomp.host,
port=config.stomp.port,
Expand Down
6 changes: 3 additions & 3 deletions src/blueapi/client/event_bus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from collections.abc import Callable

from bluesky_stomp.messaging import MessageContext, MessagingTemplate
from bluesky_stomp.messaging import MessageContext, StompClient
from bluesky_stomp.models import MessageTopic

from blueapi.core import DataEvent
Expand All @@ -17,9 +17,9 @@ def __init__(self, message: str) -> None:


class EventBusClient:
app: MessagingTemplate
app: StompClient

def __init__(self, app: MessagingTemplate) -> None:
def __init__(self, app: StompClient) -> None:
self.app = app

def __enter__(self) -> None:
Expand Down
Loading

0 comments on commit 8b35390

Please sign in to comment.