Skip to content

Commit

Permalink
Refactor dodal setter
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Mar 6, 2024
1 parent a85331c commit 5ce6ac2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ dependencies = [
"fastapi[all]<0.99",
"uvicorn",
"requests",
"dls-bluesky-core", #requires ophyd-async
"dls-dodal",
"dls_dodal @ git+https://github.com/DiamondLightSource/dodal.git@rebased_i22",
"typing_extensions<4.6",
]
dynamic = ["version"]
Expand Down
17 changes: 3 additions & 14 deletions src/blueapi/service/handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
from typing import List, Mapping, Optional

from dodal.beamlines.beamline_utils import set_directory_provider

from blueapi.config import ApplicationConfig
from blueapi.core import BlueskyContext
from blueapi.core.event import EventStream
Expand Down Expand Up @@ -150,7 +152,6 @@ def setup_handler(
) -> None:
global HANDLER

provider = None
plan_wrappers = []
if config:
visit_service_client: VisitServiceClientBase
Expand All @@ -167,19 +168,7 @@ def setup_handler(
client=visit_service_client,
)

# Make all dodal devices created by the context use provider if they can
try:
from dodal.parameters.gda_directory_provider import (
set_directory_provider_singleton,
)

set_directory_provider_singleton(provider)
except ImportError:
logging.error(
"Unable to set directory provider for ophyd-async devices, "
"a newer version of dodal is required"
)

set_directory_provider(provider)
plan_wrappers.append(lambda plan: attach_metadata(plan, provider))

handler = Handler(
Expand Down

0 comments on commit 5ce6ac2

Please sign in to comment.