config test
This commit is contained in:
parent
f82ec7a80e
commit
4c3f8a8eef
@ -82,14 +82,12 @@ class Stats:
|
||||
return octets,unit
|
||||
|
||||
def parse(self):
|
||||
res = None
|
||||
while res is None:
|
||||
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')
|
||||
|
||||
tot_part_start = tot_part_end = 0
|
||||
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""")
|
||||
consolided = {}
|
||||
moy_conf_by_day = 0
|
||||
for line in res:
|
||||
@ -158,13 +156,17 @@ class SQLite:
|
||||
self.conn.close()
|
||||
|
||||
def dbQuery(self,query='SELECT'):
|
||||
try:
|
||||
self.__openDb()
|
||||
self.cursor.execute(query)
|
||||
rows = self.cursor.fetchall()
|
||||
self.__closeDb()
|
||||
except sqlite3.OperationalError:
|
||||
rows = None
|
||||
rows = None
|
||||
while rows is None:
|
||||
try:
|
||||
self.__openDb()
|
||||
self.cursor.execute(query)
|
||||
rows = self.cursor.fetchall()
|
||||
self.__closeDb()
|
||||
except sqlite3.OperationalError:
|
||||
rows = None
|
||||
time.sleep(30)
|
||||
|
||||
return rows
|
||||
|
||||
def dbInsert(self,ts,k,v):
|
||||
|
Loading…
Reference in New Issue
Block a user