From 0edaaffe10abf68e9b297ffe783e7c6dda4e5471 Mon Sep 17 00:00:00 2001 From: Karim Ahmed <karim.ahmed@xfel.eu> Date: Wed, 14 Jul 2021 16:05:09 +0200 Subject: [PATCH] Fix / Use snapshot for injecting constants for old pdu connection --- setup.py | 2 +- src/cal_tools/tools.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 8f24bbaea..46d8d86a3 100644 --- a/setup.py +++ b/setup.py @@ -75,7 +75,7 @@ setup( }, ext_modules=cythonize(ext_modules), install_requires=[ - "iCalibrationDB @ git+ssh://git@git.xfel.eu:10022/detectors/cal_db_interactive.git@2.0.8", # noqa + "iCalibrationDB @ git+ssh://git@git.xfel.eu:10022/detectors/cal_db_interactive.git@2.0.9", # noqa "XFELDetectorAnalysis @ git+ssh://git@git.xfel.eu:10022/karaboDevices/pyDetLib.git@2.5.6-2.10.0#subdirectory=lib", # noqa "Cython==0.29.21", "Jinja2==2.11.2", diff --git a/src/cal_tools/tools.py b/src/cal_tools/tools.py index d13d97691..3896dcdfc 100644 --- a/src/cal_tools/tools.py +++ b/src/cal_tools/tools.py @@ -602,7 +602,7 @@ def send_to_db(db_module: str, karabo_id: str, constant, condition, """ success = False - + snapshot_at = None metadata = _init_metadata(constant, condition, creation_time) if db_module: @@ -635,8 +635,21 @@ def send_to_db(db_module: str, karabo_id: str, constant, condition, while ntries > 0: this_interface = get_random_db_interface(cal_db_interface) + + if ( + creation_time is not None and + hasattr(creation_time, 'isoformat') + ): + # This snapshot will be used only while retrieving + # the correct PDU and appending its UUID. + snapshot_at = creation_time.isoformat() + try: - metadata.send(this_interface, timeout=timeout) + metadata.send( + this_interface, + snapshot_at=snapshot_at, + timeout=timeout, + ) success = True # TODO: use comm_db_success break except zmq.error.Again: -- GitLab