Skip to content
Snippets Groups Projects
Commit ac1d419a authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

Decrement nTryes only in case of zmq timeout

parent d492c9de
No related branches found
No related tags found
1 merge request!101Fix: Decrement nTryes only in case of zmq timeout
...@@ -470,6 +470,7 @@ def get_from_db(device, constant, condition, empty_constant, ...@@ -470,6 +470,7 @@ def get_from_db(device, constant, condition, empty_constant,
:return: Calibration constant, metadata :return: Calibration constant, metadata
""" """
from iCalibrationDB import ConstantMetaData, Versions from iCalibrationDB import ConstantMetaData, Versions
import zmq
if device: if device:
metadata = ConstantMetaData() metadata = ConstantMetaData()
...@@ -477,33 +478,25 @@ def get_from_db(device, constant, condition, empty_constant, ...@@ -477,33 +478,25 @@ def get_from_db(device, constant, condition, empty_constant,
metadata.detector_condition = condition metadata.detector_condition = condition
if creation_time is None: if creation_time is None:
metadata.calibration_constant_version = Versions.Now(device=device) metadata.calibration_constant_version = Versions.Now(device=device)
while ntries > 0:
this_interface = get_random_db_interface(cal_db_interface)
try:
metadata.retrieve(this_interface, timeout=timeout,
meta_only=meta_only)
break
except Exception as e:
if verbosity > 0:
print(e)
ntries -= 1
else: else:
metadata.calibration_constant_version = Versions.Timespan( metadata.calibration_constant_version = Versions.Timespan(
device=device, device=device,
start=creation_time) start=creation_time)
while ntries > 0: while ntries > 0:
this_interface = get_random_db_interface(cal_db_interface) this_interface = get_random_db_interface(cal_db_interface)
try: try:
metadata.retrieve(this_interface, metadata.retrieve(this_interface, timeout=timeout,
  • Maintainer

    @karnem @ahmedk

    We introduced a major bug here: the when=creation_time.isoformat() is essential for correctly versioned retrieval. This is why we were always getting constants in the future of the time period during report testing. Essentially we were always querying for constants closed to now.

    I've fixed it in the production webservice, but please one of you urgently put up a MR to address the issue!

  • Please register or sign in to reply
when=creation_time.isoformat(), meta_only=meta_only)
timeout=timeout, meta_only=meta_only) break
break except Exception as e:
except Exception as e: if verbosity > 0:
if verbosity > 0: print(e)
print(e) if isinstance(e, zmq.error.Again):
ntries -= 1 ntries -= 1
else:
ntries = 0
if ntries > 0: if ntries > 0:
if verbosity > 0: if verbosity > 0:
if constant.name not in already_printed or verbosity > 1: if constant.name not in already_printed or verbosity > 1:
......
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