From 35c405d3581edea0f8e4babcc7e5e14f5778ae7b Mon Sep 17 00:00:00 2001 From: Ken Lauer Date: Tue, 8 Mar 2022 11:04:03 -0800 Subject: [PATCH] ENH: include per-device load time if available --- hutch_python/happi.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hutch_python/happi.py b/hutch_python/happi.py index 8f04d2e8..88987f5a 100644 --- a/hutch_python/happi.py +++ b/hutch_python/happi.py @@ -1,3 +1,4 @@ +import inspect import logging import happi @@ -62,7 +63,12 @@ def get_happi_objs(db, hutch): logger.warning("No items found in database for %s", beamline.upper()) # Instantiate the devices needed - dev_namespace = load_devices(*containers, pprint=False) + sig = inspect.signature(load_devices) + if "include_load_time" in sig.parameters: + kwargs = dict(include_load_time=True, load_time_threshold=0.5) + else: + kwargs = {} + dev_namespace = load_devices(*containers, pprint=False, **kwargs) return dev_namespace.__dict__