Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 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
723093c
Merge branch 'main' into 1691_blueapi_plan_stubs
oliwenmandiamond Nov 10, 2026
cf41bd2
Merge branch 'main' into 1691_blueapi_plan_stubs
oliwenmandiamond Nov 10, 2026
189f006
Merge branch 'main' into 1691_blueapi_plan_stubs
shree-iyengar-dls Nov 10, 2026
7ffbbf1
chore: move bluesky pin back from main branch to v1.16
shree-iyengar-dls Nov 10, 2026
46ecf0a
chore: regenerate plans.json
shree-iyengar-dls Nov 10, 2026
573f491
Merge branch 'main' into 1691_blueapi_plan_stubs
shree-iyengar-dls Nov 11, 2026
176db63
remove obsolete deps
shree-iyengar-dls Nov 11, 2026
1a70e11
update uv lock file
shree-iyengar-dls Nov 11, 2026
ffd5d26
add loc and locate to default plan stubs list
Nov 12, 2026
96a0182
Merge branch 'main' into 1691_blueapi_plan_stubs
shree-iyengar-dls Nov 12, 2026
623cfbb
tests: remove dodal plan stubs and fix tests to use bps.plan_stubs
shree-iyengar-dls Nov 13, 2026
5c4d152
Merge branch 'main' into 1691_blueapi_plan_stubs
Nov 13, 2026
f16a563
chore: update bluesky in pyproject.toml to v16
shree-iyengar-dls Nov 13, 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).

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.

I think we should make a distinction between the plans that were just added in the example and the plans available by default. At the moment it looks like you add one module and get two loads of plans to work with.

(and nit: Was this meant to point to a specific line? )


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 @@ -14,23 +14,24 @@ classifiers = [
]
description = "Lightweight bluesky-as-a-service wrapper application. Also usable as a library."
dependencies = [
"bluesky[plotting]>=1.14.0", # plotting includes matplotlib, required for BestEffortCallback in run plans
Comment thread
shree-iyengar-dls marked this conversation as resolved.
Resolved
"bluesky[plotting]>=1.16.0", # plotting includes matplotlib, required for BestEffortCallback in run plans
"ophyd-async>=0.13.5",
"pydantic>=2.0",
"pydantic-settings",
"stomp-py",
"PyYAML>=6.0.2",
"click>=8.2.0",
"requests",
"GitPython>=3.1.58", #security base min https://github.com/advisories/GHSA-4gmw-gg2m-w46p - used by the server's /python_environment endpoint and the CLI's scratch setup
"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 - used by the server's /python_environment endpoint and the CLI's scratch setup
"event-model==1.24.0", # https://github.com/DiamondLightSource/blueapi/issues/684
"bluesky-stomp>=0.1.6",
"opentelemetry-distro>=0.48b0",
"observability-utils>=0.1.4",
"pyjwt[crypto]",
"websockets",
"tqdm",
"packaging",
"bluesky-tiled-plugins>=2.0.11",
]
dynamic = ["version"]
license.file = "LICENSE"
Expand Down Expand Up @@ -62,7 +63,7 @@ dev = [
"prek",
"pydata-sphinx-theme>=0.15.4",
"pytest",
"pyright!=1.1.407", # https://github.com/bluesky/scanspec/issues/190
Comment thread
shree-iyengar-dls marked this conversation as resolved.
Resolved
"pyright!=1.1.407", # https://github.com/bluesky/scanspec/issues/190
"pytest-cov",
"pytest-asyncio",
"pytest-httpx>=0.35.0",
Expand Down
28 changes: 19 additions & 9 deletions src/blueapi/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
from importlib import import_module, metadata
from inspect import Parameter, isclass, signature
from types import ModuleType, NoneType, UnionType
from typing import (
Any,
TypeVar,
Union,
get_args,
get_origin,
get_type_hints,
)
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 ophyd_async.core import NotConnectedError, PathProvider
Expand Down Expand Up @@ -58,6 +52,19 @@

LOGGER = logging.getLogger(__name__)

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

if "ophyd" in sys.modules:
# This is an awful hack/workaround to avoid blueapi hanging on shutdown when
Expand Down Expand Up @@ -142,6 +149,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 configuration.numtracker is not None:
# The numtracker client itself is wired up by the service, see
# blueapi.service.interface.context
Expand Down Expand Up @@ -196,7 +206,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()

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.

Change not related to this change

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.

With the original |= I'm getting an error:

  Operator "|" not supported for types "RunEngineMetadata" and "Dict[str, Any]"

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
5 changes: 3 additions & 2 deletions src/blueapi/service/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
from multiprocessing.connection import Connection
from typing import Any

from bluesky.callbacks.tiled_writer import TiledWriter
from bluesky.run_engine import RunEngineMetadata
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 Expand Up @@ -63,7 +64,7 @@ def context() -> BlueskyContext:
ctx = BlueskyContext(config())
if (nt_conf := config().numtracker) is not None and (nt := numtracker()):

async def _update_scan_num(md: dict[str, Any]) -> int:
async def _update_scan_num(md: RunEngineMetadata) -> int:
scan = await nt.create_scan(md["instrument_session"], md["instrument"])
md["data_session_directory"] = str(scan.scan.directory.path)
md["detector_file_template"] = nt_conf.detector_file_template
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