Continue Flask migration.
This commit is contained in:
parent
cba1fdabc2
commit
adbc3b754b
@ -117,9 +117,10 @@ def get_metric(metric, current_time, interval):
|
|||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_forced_mode(cur):
|
def get_forced_mode():
|
||||||
cur.execute("SELECT value, timestamp FROM set_mode WHERE name='mode'")
|
row = db.session.query(Set_mode.value, Set_mode.timestamp).first()
|
||||||
row = cur.fetchone()
|
#cur.execute("SELECT value, timestamp FROM set_mode WHERE name='mode'")
|
||||||
|
#row = cur.fetchone()
|
||||||
data = dict(zip(['value', 'timestamp'], row))
|
data = dict(zip(['value', 'timestamp'], row))
|
||||||
timestamp = getDateTimeFromISO8601String(data['timestamp']).replace(tzinfo=timezone.utc).timestamp()
|
timestamp = getDateTimeFromISO8601String(data['timestamp']).replace(tzinfo=timezone.utc).timestamp()
|
||||||
# We ignore old targets but never ignore absence modes
|
# We ignore old targets but never ignore absence modes
|
||||||
@ -204,8 +205,11 @@ while True:
|
|||||||
# break
|
# break
|
||||||
|
|
||||||
if new_forced_mode is not None:
|
if new_forced_mode is not None:
|
||||||
cursor.execute("INSERT OR REPLACE INTO set_mode (value) VALUES ('"+new_forced_mode+"')")
|
data = Set_mode({"value": new_forced_mode})
|
||||||
dbconn.commit()
|
db.session.add(data)
|
||||||
|
db.session.commit()
|
||||||
|
#cursor.execute("INSERT OR REPLACE INTO set_mode (value) VALUES ('"+new_forced_mode+"')")
|
||||||
|
#dbconn.commit()
|
||||||
logging.info("Switch to "+new_forced_mode)
|
logging.info("Switch to "+new_forced_mode)
|
||||||
target_name = new_forced_mode
|
target_name = new_forced_mode
|
||||||
new_forced_mode = None
|
new_forced_mode = None
|
||||||
|
Loading…
Reference in New Issue
Block a user