From afbd07a79d38ab952e4717c79da9f978346d5695 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 17 Jul 2025 11:41:32 +0200 Subject: [PATCH] DAQ: added aaredb events to send an error message event to the db --- daq/src/aaredaq/aaredb.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/daq/src/aaredaq/aaredb.py b/daq/src/aaredaq/aaredb.py index 9b35ec8a..bf6def2d 100644 --- a/daq/src/aaredaq/aaredb.py +++ b/daq/src/aaredaq/aaredb.py @@ -122,6 +122,28 @@ class AareWrapper: except Exception as e: print(e) + def sample_failed(self, s: Optional[SampleShortInfo]): + if s is None: + return + try: + self.__sample_api.create_sample_event( + sample_id=s.db_id, + sample_event_create=SampleEventCreate(event_type="Failed"), + ) + except Exception as e: + print(e) + + def sample_lost(self, s: Optional[SampleShortInfo]): + if s is None: + return + try: + self.__sample_api.create_sample_event( + sample_id=s.db_id, + sample_event_create=SampleEventCreate(event_type="Lost"), + ) + except Exception as e: + print(e) + def upload_image(self, sample_id: int, filename: str, bgr_image: np.ndarray): _, buffer = cv2.imencode('.jpg', bgr_image) jpeg_bytes = io.BytesIO(buffer)