fix an issue where we might not store some log entries
@@ -50,9 +50,14 @@ class ConsoleUpdate(Resource):
g.db.execute("""
INSERT INTO console (job_id, output) VALUES (%s, %s);
+ """, [job_id, log])
+ g.db.commit() # Commit here, updating job state later on might fail
+
+ g.db.execute("""
UPDATE job SET state = 'running', start_date = current_timestamp
- WHERE id = %s and state = 'scheduled'""", [job_id, log, job_id])
+ WHERE id = %s
+ AND state = 'scheduled'
+ """, [job_id])
g.db.commit()
return {}
-
