config test
This commit is contained in:
parent
f82ec7a80e
commit
4c3f8a8eef
@ -82,14 +82,12 @@ class Stats:
|
|||||||
return octets,unit
|
return octets,unit
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
res = None
|
tot_part_start = tot_part_end = 0
|
||||||
while res is None:
|
res = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp = {self.startDate} AND key_field = 'total_participants' ORDER by id""")
|
||||||
|
print(res)
|
||||||
|
res = self.db.dbQuery(f"""SELECT value_field FROM {dbName} WHERE timestamp = {self.endDate} AND key_field = 'total_participants' ORDER by id""")
|
||||||
|
print(res)
|
||||||
res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""")
|
res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""")
|
||||||
if res is None:
|
|
||||||
time.sleep(60)
|
|
||||||
#if res is None:
|
|
||||||
# sys.exit('Traitement en cours, base de données indisponible')
|
|
||||||
|
|
||||||
consolided = {}
|
consolided = {}
|
||||||
moy_conf_by_day = 0
|
moy_conf_by_day = 0
|
||||||
for line in res:
|
for line in res:
|
||||||
@ -158,6 +156,8 @@ class SQLite:
|
|||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
|
||||||
def dbQuery(self,query='SELECT'):
|
def dbQuery(self,query='SELECT'):
|
||||||
|
rows = None
|
||||||
|
while rows is None:
|
||||||
try:
|
try:
|
||||||
self.__openDb()
|
self.__openDb()
|
||||||
self.cursor.execute(query)
|
self.cursor.execute(query)
|
||||||
@ -165,6 +165,8 @@ class SQLite:
|
|||||||
self.__closeDb()
|
self.__closeDb()
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
rows = None
|
rows = None
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
def dbInsert(self,ts,k,v):
|
def dbInsert(self,ts,k,v):
|
||||||
|
Loading…
Reference in New Issue
Block a user