Skip to content
Snippets Groups Projects
Commit e6bf4215 authored by System User's avatar System User
Browse files

[ArchiveExtractor] Compatibilité avec le MODE_EVT

* l'API retourne à présent MODE_EVT pour les attributs archivés sur évènement
* Sur ce retour, on réagit en forçant une estimation de sampling à 0.1Hz pour le calcul des chunks
parent 73d66b2b
No related branches found
No related tags found
No related merge requests found
......@@ -127,20 +127,24 @@ def query_ADB_BetweenDates(attr,
raise ValueError("Attribute '%s' is not archived in DB %s"%(attr, extractor))
# Get its sampling period in seconds
try:
samplingPeriod = int(ADB.GetArchivingMode(attr)[1])*10**-3
req=ADB.GetArchivingMode(attr)
logger.debug("GetArchivingMode: "+str(req))
if req[0] == "MODE_P":
samplingPeriod = int(req[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)
elif req[0] == "MODE_EVT":
logger.warning("Attribute is archived on event. Chunks of data are sized with an estimated datarate of 0.1Hz")
samplingPeriod = 10
else:
raise NotImplemented("Archive mode not implemented")
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
# Evaluate the number of points
est_N = (dateStop-dateStart).total_seconds()/samplingPeriod
logger.debug("Which leads to %d points to extract."%est_N)
# If data chunk is too much, we need to cut it
if est_N > Nmax:
......
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