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

additional iconfig options from framework #278

Merged
merged 6 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ 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
Expand Down
25 changes: 13 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 Down Expand Up @@ -96,18 +96,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

# set default timeout for all EpicsSignal connections & communications
TIMEOUT = 60
Expand All @@ -119,8 +120,8 @@ def get_md_path():
connection_timeout=iconfig.get("PV_CONNECTION_TIMEOUT", TIMEOUT),
)

# Create a registry of ophyd devices
registry = Registry(auto_register=True)
# Create a registry of ophyd devices.
oregistry = Registry(auto_register=True)

_pv = iconfig.get("RUN_ENGINE_SCAN_ID_PV")
if _pv is None:
Expand Down
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
Loading