Skip to content
Snippets Groups Projects
Commit aa924231 authored by Steffen Hauf's avatar Steffen Hauf
Browse files

Feat: Retrieve only meta data

See merge request detectors/pycalibration!77
parents 5aaae20e a73e689b
No related branches found
No related tags found
1 merge request!77Feat: Retrieve only meta data
...@@ -465,7 +465,7 @@ already_printed = {} ...@@ -465,7 +465,7 @@ already_printed = {}
def get_from_db(device, constant, condition, empty_constant, def get_from_db(device, constant, condition, empty_constant,
cal_db_interface, creation_time=None, cal_db_interface, creation_time=None,
verbosity=1, timeout=30000, ntries=120): verbosity=1, timeout=30000, ntries=120, meta_only=True):
""" """
Return calibration constants and metadata requested from CalDB Return calibration constants and metadata requested from CalDB
...@@ -478,6 +478,8 @@ def get_from_db(device, constant, condition, empty_constant, ...@@ -478,6 +478,8 @@ def get_from_db(device, constant, condition, empty_constant,
:param verbosity: Level of verbosity (0 - silent) :param verbosity: Level of verbosity (0 - silent)
:param timeout: Timeout for zmq request :param timeout: Timeout for zmq request
:param ntries: number of tries to contact the database :param ntries: number of tries to contact the database
:param meta_only: Retrieve only metadata via ZMQ. Constants are taken
directly from the h5 file on maxwell.
:return: Calibration constant, metadata :return: Calibration constant, metadata
""" """
from iCalibrationDB import ConstantMetaData, Versions from iCalibrationDB import ConstantMetaData, Versions
...@@ -508,7 +510,7 @@ def get_from_db(device, constant, condition, empty_constant, ...@@ -508,7 +510,7 @@ def get_from_db(device, constant, condition, empty_constant,
try: try:
metadata.retrieve(this_interface, metadata.retrieve(this_interface,
when=creation_time.isoformat(), when=creation_time.isoformat(),
timeout=6000000, meta_only=True) timeout=6000000, meta_only=meta_only)
break break
except Exception as e: except Exception as e:
if verbosity > 0: if verbosity > 0:
...@@ -531,14 +533,14 @@ def get_from_db(device, constant, condition, empty_constant, ...@@ -531,14 +533,14 @@ def get_from_db(device, constant, condition, empty_constant,
def get_constant_from_db(device, constant, condition, empty_constant, def get_constant_from_db(device, constant, condition, empty_constant,
cal_db_interface, creation_time=None, cal_db_interface, creation_time=None,
print_once=True, timeout=30000, ntries=120): print_once=True, timeout=30000, ntries=120,
meta_only=True):
""" """
Return calibration constants requested from CalDB Return calibration constants requested from CalDB
""" """
data, _ = get_from_db(device, constant, condition, empty_constant, data, _ = get_from_db(device, constant, condition, empty_constant,
cal_db_interface, creation_time, cal_db_interface, creation_time,
int(print_once), timeout, ntries) int(print_once), timeout, ntries, meta_only)
return data return data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment