Skip to content

Commit

Permalink
additional iconfig options from framework (#278)
Browse files Browse the repository at this point in the history
* MNT #250 enable options as configuration items

* DOC #250

* MNT #250 omission

* MNT #250 new name

* DOC #250 update release notes
  • Loading branch information
prjemian authored Feb 26, 2024
1 parent 38189ef commit f0991ab
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
7 changes: 6 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ release expected by 2024-03-01
New Features
------------

* Add options to instrument configuration (iconfig.yml):

* After every run, verify that files were saved, print a confirmation message.
* Debugging and message options.

* Add package(s) to environment:

* ophyd-registry

* Build ``registry`` of all ophyd objects.
* Build ``oregistry`` of all ophyd objects.

Maintenance
------------
Expand Down
24 changes: 12 additions & 12 deletions bluesky/instrument/framework/initialize.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
initialize the bluesky framework
Initialize the bluesky framework.
"""

__all__ = """
RE cat sd bec peaks
bp bps bpp
summarize_plan
np
registry
""".split()
oregistry
""".split()

import logging

Expand All @@ -31,7 +31,6 @@
from bluesky.utils import ProgressBarManager
from bluesky.utils import ts_msg_hook
from IPython import get_ipython
from ophyd.signal import EpicsSignalBase
from ophydregistry import Registry
import databroker
import ophyd
Expand Down Expand Up @@ -96,18 +95,19 @@ def get_md_path():

# At the end of every run, verify that files were saved and
# print a confirmation message.
# from bluesky.callbacks.broker import verify_files_saved
# RE.subscribe(post_run(verify_files_saved), 'stop')
if iconfig.get("VERIFY_FILES_SAVED", False):
from bluesky.callbacks.broker import post_run
from bluesky.callbacks.broker import verify_files_saved

# Uncomment the following lines to turn on
# verbose messages for debugging.
# ophyd.logger.setLevel(logging.DEBUG)
RE.subscribe(post_run(verify_files_saved), "stop")

ophyd.logger.setLevel(iconfig.get("LOGGING", {}).get("OPHYD_LOGGER_LEVEL", "WARNING"))
ophyd.set_cl(iconfig.get("OPHYD_CONTROL_LAYER", "PyEpics").lower())
logger.info(f"using ophyd control layer: {ophyd.cl.name}")

# diagnostics
# RE.msg_hook = ts_msg_hook
if iconfig.get("ADD_DIAGNOSTIC_MESSAGES", False):
# Log bluesky Message objects in RunEngine (follow plan's progress).
RE.msg_hook = ts_msg_hook

if iconfig.get("RUN_ENGINE_SCAN_ID_PV") is not None:
from ..epics_signal_config import epics_scan_id_source
Expand All @@ -119,4 +119,4 @@ def get_md_path():
RE.md["scan_id"] = scan_id_epics.get()

# Create a registry of ophyd devices
registry = Registry(auto_register=True)
oregistry = Registry(auto_register=True)
8 changes: 6 additions & 2 deletions bluesky/instrument/iconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ AD_MOUNT_PATH: /tmp
BLUESKY_MOUNT_PATH: /tmp/docker_ioc/iocad/tmp

# permissions
ADD_DIAGNOSTIC_MESSAGES: false
ALLOW_AREA_DETECTOR_WARMUP: true
ENABLE_AREA_DETECTOR_IMAGE_PLUGIN: true
ENABLE_CALCS: true
USE_PROGRESS_BAR: false
WRITE_NEXUS_DATA_FILES: true
NEXUS_WARN_MISSING_CONTENT: false
NEXUS_FILE_EXTENSION: hdf
VERIFY_FILES_SAVED: False
WRITE_SPEC_DATA_FILES: true

# ----------------------------------
Expand All @@ -52,9 +54,11 @@ WRITE_SPEC_DATA_FILES: true
LOGGING:
# MAX_BYTES: 1000000
NUMBER_OF_PREVIOUS_BACKUPS: 9
# LOG_PATH: /tmp
# If LOG_PATH undefined, this session will log into PWD/logs/
# where PWD is present working directory when session is started
# where PWD is present working directory when session is started.
# LOG_PATH: /tmp
# Use "DEBUG" to turn on verbose messages for debugging.
OPHYD_LOGGER_LEVEL: WARNING

# default timeouts (seconds)
PV_READ_TIMEOUT: &TIMEOUT 15
Expand Down

0 comments on commit f0991ab

Please sign in to comment.