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

Post a warning if at APS but not on controls subnet. #277

Merged
merged 4 commits into from
Feb 26, 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
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
Loading