From 0c28affd8c43732fb489c2d23e70f557616db21b Mon Sep 17 00:00:00 2001 From: Romain Broucquart <romain.broucquart@synchrotron-soleil.fr> Date: Thu, 17 Sep 2020 10:56:25 +0200 Subject: [PATCH] [ArchiveExtractor] Add bypass for attributes archived on events Bypass the chunk estimation for now. --- ArchiveExtractor.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ArchiveExtractor.py b/ArchiveExtractor.py index 1956225..f5bb847 100755 --- a/ArchiveExtractor.py +++ b/ArchiveExtractor.py @@ -127,12 +127,20 @@ def query_ADB_BetweenDates(attr, raise ValueError("Attribute '%s' is not archived in DB %s"%(attr, extractor)) # Get its sampling period in seconds - samplingPeriod = int(ADB.GetArchivingMode(attr)[1])*10**-3 - logger.debug("Attribute is sampled every %g seconds"%samplingPeriod) + try: + samplingPeriod = int(ADB.GetArchivingMode(attr)[1])*10**-3 + logger.debug("Attribute is sampled every %g seconds"%samplingPeriod) - # Evaluate the number of points - est_N = (dateStop-dateStart).total_seconds()/samplingPeriod - logger.debug("Which leads to %d points to extract."%est_N) + # Evaluate the number of points + est_N = (dateStop-dateStart).total_seconds()/samplingPeriod + logger.debug("Which leads to %d points to extract."%est_N) + + except ValueError: + logger.warning("Attribute has no sampling period. Maybe it's archived on event.") + logger.warning("Please note that this script does not cut acces into chunks for this type of attributes.") + + # Temporary bypass estimation + est_N = 1 # If data chunk is too much, we need to cut it if est_N > Nmax: @@ -353,7 +361,8 @@ if __name__ == "__main__": # Add to result dictionnary results[attr] = datevalue - except ValueError: + except ValueError as e: + logger.debug("ErrorMsg: %s"%e) logger.warning("Failed to extract %s. Skipping..."%attr) except tango.CommunicationFailed: logger.warning("Failed to extract %s. Skipping..."%attr) -- GitLab