Skip to content

Commit

Permalink
Post a warning if at APS but not on controls subnet. (#277)
Browse files Browse the repository at this point in the history
* MNT #255 add the check

* DOC #255

* STY #255 per 'ruff'
  • Loading branch information
prjemian authored Feb 26, 2024
1 parent 78b6738 commit 89b71b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ New Features
* ophyd-registry

* Build ``oregistry`` of all ophyd objects.
* Post a warning if at APS but not on controls subnet.

Maintenance
------------
Expand Down
7 changes: 4 additions & 3 deletions bluesky/instrument/framework/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
sys.path.append(str(pathlib.Path(__file__).absolute().parent.parent.parent))

from .. import iconfig
from apstools.utils import warn_if_not_aps_controls_subnet
from bluesky import RunEngine
from bluesky import SupplementalData
from bluesky.callbacks.best_effort import BestEffortCallback
Expand All @@ -42,6 +43,9 @@
import bluesky.preprocessors as bpp # noqa
import numpy as np # noqa

# Post a warning if at APS but not on controls subnet.
warn_if_not_aps_controls_subnet()


def get_md_path():
path = iconfig.get("RUNENGINE_MD_PATH")
Expand All @@ -52,12 +56,10 @@ def get_md_path():
logger.info("RunEngine metadata saved in directory: %s", str(path))
return str(path)


# Set up a RunEngine and use metadata backed PersistentDict
RE = RunEngine({})
RE.md = PersistentDict(get_md_path())


# Connect with our mongodb database
catalog_name = iconfig.get("DATABROKER_CATALOG", "training")
# databroker v2 api
Expand All @@ -68,7 +70,6 @@ def get_md_path():
cat = databroker.temp().v2
logger.info("using TEMPORARY databroker catalog '%s'", cat.name)


# Subscribe metadatastore to documents.
# If this is removed, data is not saved to metadatastore.
RE.subscribe(cat.v1.insert)
Expand Down

0 comments on commit 89b71b2

Please sign in to comment.