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

Defer implementation of MsgGenerator to prevent strange behaviour #832

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions src/dodal/common/types.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from abc import ABC, abstractmethod
from collections.abc import Callable, Generator
from typing import (
Any,
)
from collections.abc import Callable

from bluesky.utils import Msg
from bluesky.utils import MsgGenerator
from ophyd_async.core import PathProvider

# String identifier used by 'wait' or stubs that await
Group = str
# A true 'plan', usually the output of a generator function
MsgGenerator = Generator[Msg, Any, None]
# A function that generates a plan
PlanGenerator = Callable[..., MsgGenerator]

Expand Down
4 changes: 2 additions & 2 deletions src/dodal/plans/data_session_metadata.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from bluesky import plan_stubs as bps
from bluesky import preprocessors as bpp
from bluesky.utils import make_decorator
from bluesky.utils import MsgGenerator, make_decorator

from dodal.common.beamlines import beamline_utils
from dodal.common.types import MsgGenerator, UpdatingPathProvider
from dodal.common.types import UpdatingPathProvider

DATA_SESSION = "data_session"
DATA_GROUPS = "data_groups"
Expand Down
3 changes: 1 addition & 2 deletions src/dodal/plans/motor_util_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

from bluesky import plan_stubs as bps
from bluesky.preprocessors import finalize_wrapper, pchain
from bluesky.utils import Msg, make_decorator
from bluesky.utils import Msg, MsgGenerator, make_decorator
from ophyd_async.core import Device
from ophyd_async.epics.motor import Motor

from dodal.common import MsgGenerator
from dodal.utils import MovableReadable

MovableReadableDevice = TypeVar("MovableReadableDevice", bound=MovableReadable)
Expand Down
2 changes: 1 addition & 1 deletion tests/common/test_coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import pytest
from bluesky.protocols import Movable
from bluesky.utils import MsgGenerator

from dodal.common.coordination import group_uuid, inject
from dodal.common.types import MsgGenerator

static_uuid = "51aef931-33b4-4b33-b7ad-a8287f541202"

Expand Down
3 changes: 2 additions & 1 deletion tests/preprocessors/test_filesystem_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
)
from bluesky.protocols import HasName, Readable, Reading, Triggerable
from bluesky.run_engine import RunEngine
from bluesky.utils import MsgGenerator
from event_model.documents.event_descriptor import DataKey
from ophyd_async.core import AsyncStatus, DeviceCollector, PathProvider
from pydantic import BaseModel

from dodal.common.types import MsgGenerator, UpdatingPathProvider
from dodal.common.types import UpdatingPathProvider
from dodal.common.visit import (
DataCollectionIdentifier,
DirectoryServiceClient,
Expand Down
Loading