Skip to content

Commit

Permalink
Prevent exposing unintended startup values
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Sep 17, 2024
1 parent 663c8e2 commit 3717f3e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
4 changes: 2 additions & 2 deletions helm/blueapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ worker:
env:
sources:
- kind: deviceFunctions
module: blueapi.startup.example_devices
module: blueapi.startup
- kind: planFunctions
module: blueapi.startup.example_plans
module: blueapi.startup
stomp:
auth:
username: guest
Expand Down
6 changes: 2 additions & 4 deletions src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ class EnvironmentConfig(BlueapiBaseModel):
"""

sources: list[Source] = [
Source(
kind=SourceKind.DEVICE_FUNCTIONS, module="blueapi.startup.example_devices"
),
Source(kind=SourceKind.PLAN_FUNCTIONS, module="blueapi.startup.example_plans"),
Source(kind=SourceKind.DEVICE_FUNCTIONS, module="blueapi.startup"),
Source(kind=SourceKind.PLAN_FUNCTIONS, module="blueapi.startup"),
]
events: WorkerEventConfig = Field(default_factory=WorkerEventConfig)

Expand Down
27 changes: 27 additions & 0 deletions src/blueapi/startup/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .example_devices import (
current_det,
image_det,
sample_pressure,
sample_temperature,
theta,
unplugged_motor,
x,
x_err,
y,
z,
)
from .example_plans import scan

__all__ = [
"x",
"y",
"z",
"theta",
"current_det",
"image_det",
"sample_pressure",
"sample_temperature",
"unplugged_motor",
"x_err",
"scan",
]
7 changes: 5 additions & 2 deletions src/blueapi/startup/example_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Annotated, Any

import bluesky.plans as bp
from bluesky.protocols import Movable, Readable
from bluesky.protocols import HasName, Movable, Readable
from cycler import Cycler, cycler
from dodal.common import MsgGenerator
from dodal.plans.data_session_metadata import attach_data_session_metadata_decorator
Expand All @@ -18,14 +18,17 @@
"""


class NamedMovable(HasName, Movable): ...


@attach_data_session_metadata_decorator()
@validate_call(config={"arbitrary_types_allowed": True})
def scan(
detectors: Annotated[
set[Readable], "Set of readable devices, will take a reading at each point"
],
axes_to_move: Annotated[
Mapping[str, Movable], "All axes involved in this scan, names and objects"
Mapping[str, NamedMovable], "All axes involved in this scan, names and objects"
],
spec: Annotated[Spec[str], "ScanSpec modelling the path of the scan"],
metadata: Mapping[str, Any] | None = None,
Expand Down

0 comments on commit 3717f3e

Please sign in to comment.