Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4866f5a
feat: add default plans list
shree-iyengar-dls Oct 8, 2026
d112abe
chore: pin to bluesky main to get new msg generator merged changes
shree-iyengar-dls Oct 13, 2026
45c0490
chore: fix tiled import plugins
shree-iyengar-dls Oct 13, 2026
e3caf4c
chore: changes due to updates in bluesky main
shree-iyengar-dls Oct 13, 2026
d96a6fb
chore: add * to stop functions
shree-iyengar-dls Oct 15, 2026
57d4248
feat: add default plans list
shree-iyengar-dls Oct 8, 2026
2c307e4
chore: pin to bluesky main to get new msg generator merged changes
shree-iyengar-dls Oct 13, 2026
c8b214c
chore: fix tiled import plugins
shree-iyengar-dls Oct 13, 2026
3c5b194
chore: changes due to updates in bluesky main
shree-iyengar-dls Oct 13, 2026
b020927
chore: add * to stop functions
shree-iyengar-dls Oct 15, 2026
e6ab3b5
chore: regenerate uv lock file
shree-iyengar-dls Oct 23, 2026
6560523
Add plans schema for system tests
oliwenmandiamond Oct 23, 2026
07a920a
Merge branch '1691_blueapi_plan_stubs' of github.com:DiamondLightSour…
oliwenmandiamond Oct 23, 2026
4dc37cc
changes to uv lock file
shree-iyengar-dls Oct 23, 2026
00250ff
Update schema again
oliwenmandiamond Oct 23, 2026
c86e8fc
Merge branch '1691_blueapi_plan_stubs' of github.com:DiamondLightSour…
oliwenmandiamond Oct 23, 2026
767bbba
chore: remove dodal plan stubs wrapped from config.yaml
shree-iyengar-dls Oct 26, 2026
2805249
Merge branch 'main' into 1691_blueapi_plan_stubs
oliwenmandiamond Oct 26, 2026
48293eb
regenerate plans.json
shree-iyengar-dls Oct 26, 2026
e2bba11
merge main into my branch
shree-iyengar-dls Oct 26, 2026
d32d122
change set_absolue to abs_set and remove dodal wrapped plan stubs fro…
Oct 26, 2026
0dc41cf
Merge branch 'main' into 1691_blueapi_plan_stubs
shree-iyengar-dls Oct 27, 2026
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
2 changes: 0 additions & 2 deletions docs/resources/config_pre_made.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ env:
module: blueapi.tutorial.devices
- kind: planFunctions
module: dodal.plans
- kind: planFunctions
module: dodal.plan_stubs.wrapped
stomp:
enabled: true
url: tcp://localhost:61613/
4 changes: 1 addition & 3 deletions docs/tutorials/4. config-add-plans.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ As well as adding devices to the `config.yaml`, you can add plans. Under the cod
``` yaml
- kind: planFunctions
module: dodal.plans
- kind: planFunctions
module: dodal.plan_stubs.wrapped
```
These plans that will be used in this tutorial can be found in the [dodal repository](https://github.com/DiamondLightSource/dodal/tree/b4b38f1e0cf480faeb29d67695440c45a148f169). Specifically, in `dodal/src/dodal/plans/wrapped.py` and `dodal/src/dodal/plan_stubs/wrapped.py`.
These plans that will be used in this tutorial can be found in the [dodal repository](https://github.com/DiamondLightSource/dodal/tree/b4b38f1e0cf480faeb29d67695440c45a148f169). Specifically, in `dodal/src/dodal/plans/wrapped.py` and [bluesky repository](https://github.com/bluesky/bluesky/blob/1fb2f4e13437edf4a72372dacd455cfaf905f09e/src/bluesky/plan_stubs.py#L321).

Save the changes you've made to the `config.yaml` file. Navigate back to the terminal where the blueapi worker is running. Restart the server to use this updated `config.yaml` file.

Expand Down
2 changes: 0 additions & 2 deletions docs/tutorials/5. config-add-rabbitmq-and-run-plan-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ env:
module: blueapi.tutorial.devices
- kind: planFunctions
module: dodal.plans
- kind: planFunctions
module: dodal.plan_stubs.wrapped
stomp:
enabled: true
url: tcp://localhost:61613/
Expand Down
4 changes: 2 additions & 2 deletions helm/blueapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ A Helm chart deploying a worker pod that runs Bluesky plans
| tracing | object | `{"fastapi":{"excludedURLs":"/healthz"},"otlp":{"enabled":false,"protocol":"http/protobuf","server":{"host":"http://opentelemetry-collector.tracing","port":4318}}}` | Exclude health probe requests from tracing by default to prevent spamming |
| volumeMounts | list | `[]` | Additional volumeMounts on the output StatefulSet definition. Define how volumes are mounted to the container referenced by using the same name. |
| volumes | list | `[]` | Additional volumes on the output StatefulSet definition. Define volumes from e.g. Secrets, ConfigMaps or the Filesystem |
| worker | object | `{"api":{"url":"http://0.0.0.0:8000/"},"env":{"sources":[{"kind":"planFunctions","module":"dodal.plans"},{"kind":"planFunctions","module":"dodal.plan_stubs.wrapped"}]},"logging":{"graylog":{"enabled":false,"url":"tcp://graylog-log-target.diamond.ac.uk:12231/"},"level":"INFO"},"scratch":{"repositories":[],"root":"/workspace"},"stomp":{"auth":{"password":"guest","username":"guest"},"enabled":false,"url":"tcp://rabbitmq:61613/"}}` | Config for the worker goes here, will be mounted into a config file |
| worker | object | `{"api":{"url":"http://0.0.0.0:8000/"},"env":{"sources":[{"kind":"planFunctions","module":"dodal.plans"}]},"logging":{"graylog":{"enabled":false,"url":"tcp://graylog-log-target.diamond.ac.uk:12231/"},"level":"INFO"},"scratch":{"repositories":[],"root":"/workspace"},"stomp":{"auth":{"password":"guest","username":"guest"},"enabled":false,"url":"tcp://rabbitmq:61613/"}}` | Config for the worker goes here, will be mounted into a config file |
| worker.api.url | string | `"http://0.0.0.0:8000/"` | 0.0.0.0 required to allow non-loopback traffic If using hostNetwork, the port must be free on the host |
| worker.env.sources | list | `[{"kind":"planFunctions","module":"dodal.plans"},{"kind":"planFunctions","module":"dodal.plan_stubs.wrapped"}]` | modules (must be installed in the venv) to fetch devices/plans from |
| worker.env.sources | list | `[{"kind":"planFunctions","module":"dodal.plans"}]` | modules (must be installed in the venv) to fetch devices/plans from |
| worker.logging | object | `{"graylog":{"enabled":false,"url":"tcp://graylog-log-target.diamond.ac.uk:12231/"},"level":"INFO"}` | Configures logging. Port 12231 is the `dodal` input on graylog which will be renamed `blueapi` |
| worker.scratch | object | `{"repositories":[],"root":"/workspace"}` | If initContainer is enabled the default branch of python projects in this section are installed into the venv *without their dependencies* |
| worker.stomp | object | `{"auth":{"password":"guest","username":"guest"},"enabled":false,"url":"tcp://rabbitmq:61613/"}` | Message bus configuration for returning status to GDA/forwarding documents downstream Password may be in the form ${ENV_VAR} to be fetched from an environment variable e.g. mounted from a SealedSecret |
2 changes: 0 additions & 2 deletions helm/blueapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ worker:
# module: dodal.beamlines.adsim
- kind: planFunctions
module: dodal.plans
- kind: planFunctions
module: dodal.plan_stubs.wrapped
# -- Message bus configuration for returning status to GDA/forwarding documents downstream
# Password may be in the form ${ENV_VAR} to be fetched from an environment variable e.g. mounted from a SealedSecret
stomp:
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers = [
description = "Lightweight bluesky-as-a-service wrapper application. Also usable as a library."
dependencies = [
"tiled[client]==0.2.18",
"bluesky[plotting]>=1.14.0", # plotting includes matplotlib, required for BestEffortCallback in run plans
"bluesky[plotting] @ git+https://github.com/bluesky/bluesky.git@main", # plotting includes matplotlib, required for BestEffortCallback in run plans

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot do git dependencies and have a published release.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah yeah. Just doing this for now until there's a new release of bluesky that has the new typing changes

"ophyd-async>=0.13.5",
"aioca",
"pydantic>=2.0",
Expand All @@ -26,8 +26,8 @@ dependencies = [
"fastapi>=0.112.0",
"uvicorn>=0.52.1",
"requests",
"GitPython>=3.1.58", #security base min https://github.com/advisories/GHSA-4gmw-gg2m-w46p
"event-model==1.24.0", # https://github.com/DiamondLightSource/blueapi/issues/684
"GitPython>=3.1.58", #security base min https://github.com/advisories/GHSA-4gmw-gg2m-w46p
"event-model==1.24.0", # https://github.com/DiamondLightSource/blueapi/issues/684
"bluesky-stomp>=0.1.6",
"opentelemetry-distro>=0.48b0",
"opentelemetry-instrumentation-fastapi>=0.48b0",
Expand All @@ -37,6 +37,7 @@ dependencies = [
"graypy>=2.1.0",
"httpx>=0.28.1",
"aiohttp>=3.13.5",
"bluesky-tiled-plugins>=2.0.11",
]
dynamic = ["version"]
license.file = "LICENSE"
Expand All @@ -55,7 +56,7 @@ dev = [
"prek",
"pydata-sphinx-theme>=0.15.4",
"pytest",
"pyright!=1.1.407", # https://github.com/bluesky/scanspec/issues/190
"pyright!=1.1.407", # https://github.com/bluesky/scanspec/issues/190
"pytest-cov",
"pytest-asyncio",
"pytest-httpx>=0.35.0",
Expand Down
20 changes: 17 additions & 3 deletions src/blueapi/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from types import ModuleType, NoneType, UnionType
from typing import Any, TypeVar, Union, get_args, get_origin, get_type_hints

import bluesky.plan_stubs as bps
from bluesky.protocols import HasName
from bluesky.run_engine import RunEngine
from bluesky.run_engine import RunEngine, RunEngineMetadata
from ophyd_async.core import NotConnectedError, PathProvider
from pydantic import (
BaseModel,
Expand Down Expand Up @@ -52,6 +53,16 @@

LOGGER = logging.getLogger(__name__)

DEFAULT_PLAN_STUBS = [
bps.abs_set,
bps.rel_set,
bps.mv,
bps.mvr,
bps.sleep,
bps.wait,
bps.rd,
bps.stop,
]

if "ophyd" in sys.modules:
# This is an awful hack/workaround to avoid blueapi hanging on shutdown when
Expand Down Expand Up @@ -137,6 +148,9 @@ def __post_init__(self, configuration: ApplicationConfig | None):
if not configuration:
return

for plan_stub in DEFAULT_PLAN_STUBS:
self.register_plan(plan_stub)

if (nt_conf := configuration.numtracker) is not None:
if configuration.env.metadata is not None:
self.numtracker = NumtrackerClient(url=nt_conf.url)
Expand All @@ -155,7 +169,7 @@ def __post_init__(self, configuration: ApplicationConfig | None):
# local reference so it's available in _update_scan_num
numtracker = self.numtracker

async def _update_scan_num(md: dict[str, Any]) -> int:
async def _update_scan_num(md: RunEngineMetadata) -> int:
scan = await numtracker.create_scan(
md["instrument_session"], md["instrument"]
)
Expand Down Expand Up @@ -203,7 +217,7 @@ def find_device(self, addr: str | list[str]) -> Device | None:

def with_config(self, config: EnvironmentConfig) -> None:
if config.metadata is not None:
self.run_engine.md |= config.metadata.model_dump()
self.run_engine.md.update(config.metadata.model_dump())

package_map = metadata.packages_distributions()
packages = {src.module.split(".")[0] for src in config.sources}
Expand Down
2 changes: 1 addition & 1 deletion src/blueapi/service/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from multiprocessing.connection import Connection
from typing import Any

from bluesky.callbacks.tiled_writer import TiledWriter
from bluesky_stomp.messaging import StompClient
from bluesky_stomp.models import Broker, DestinationBase, MessageTopic
from bluesky_tiled_plugins import TiledWriter
from fastapi import status
from tiled.client import from_uri
from tiled.client.utils import ClientError
Expand Down
2 changes: 0 additions & 2 deletions tests/system_tests/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ env:
module: dodal.beamlines.adsim
- kind: planFunctions
module: dodal.plans
- kind: planFunctions
module: dodal.plan_stubs.wrapped
stomp:
enabled: true
url: tcp://localhost:61613/
Expand Down
Loading
Loading