apsbits.core.run_engine_init#

Setup and initialize the Bluesky RunEngine.#

This module provides the function init_RE to create and configure a Bluesky RunEngine with metadata storage, subscriptions, and various settings based on a configuration dictionary.

init_RE(iconfig[, bec_instance, cat_instance])

Initialize and configure a Bluesky RunEngine instance.

Functions

init_RE(iconfig[, bec_instance, cat_instance])

Initialize and configure a Bluesky RunEngine instance.

apsbits.core.run_engine_init.init_RE(iconfig: Dict[str, Any], bec_instance: Any | None = None, cat_instance: Any | None = None) Tuple[bluesky.RunEngine, bluesky.SupplementalData][source]#

Initialize and configure a Bluesky RunEngine instance.

This function creates a Bluesky RunEngine, sets up metadata storage, subscriptions, and various preprocessors based on the provided configuration dictionary. It configures the control layer and timeouts, attaches supplemental data for baselines and monitors, and optionally adds a progress bar and metadata updates from a catalog or BestEffortCallback.

Parameters:
  • iconfig (Dict[str, Any]) – Configuration dictionary with keys including: - “RUN_ENGINE”: A dict containing RunEngine-specific settings. - “DEFAULT_METADATA”: (Optional) Default metadata for the RunEngine. - “USE_PROGRESS_BAR”: (Optional) Boolean flag to enable the progress bar. - “OPHYD”: A dict for control layer settings (e.g., “CONTROL_LAYER” and “TIMEOUTS”).

  • bec_instance (Optional[Any]) – Instance of BestEffortCallback for subscribing to the RunEngine. Defaults to None.

  • cat_instance (Optional[Any]) – Instance of a databroker catalog for subscribing to the RunEngine. Defaults to None.

Returns:

A tuple containing the configured RunEngine instance and its associated SupplementalData.

Return type:

Tuple[bluesky.RunEngine, bluesky.SupplementalData]

Notes

The function attempts to set up persistent metadata storage in the RE.md attr. If an error occurs during the creation of the metadata storage handler, the error is logged and the function proceeds without persistent metadata. Subscriptions are added for the catalog and BestEffortCallback if provided, and additional configurations such as control layer, timeouts, and progress bar integration are applied.