Commit 93a04d6f authored by Andreas Valder's avatar Andreas Valder
Browse files

removed "finished" endpoint in jobs and added functionality to ping

parent 84f568a8
......@@ -59,17 +59,10 @@ def jobs_ping(id):
hostname = request.values['host']
status = json.dumps(request.values['status'], default=date_json_handler)
state = request.values['state']
query('UPDATE jobs SET worker = ?, last_ping = ?, status = ?, state = ? where id = ?', hostname, datetime.now(), status, state, id)
return 'OK',200
@app.route('/jobs/api/job/<int:id>/finished', methods=['GET', 'POST'])
@jobs_api_token_required
def jobs_finished(id):
if 'status' in request.values:
status = request.values['status']
if state == 'finished':
query('UPDATE jobs SET time_finished = ?, status = ?, state = "finished" where id = ?', datetime.now(), status, id)
else:
status = json.dumps(request.get_json()['status'], default=date_json_handler)
query('UPDATE jobs SET time_finished = ?, status = ?, state = "finished" where id = ?', datetime.now(), status, id)
query('UPDATE jobs SET worker = ?, last_ping = ?, status = ?, state = ? where id = ?', hostname, datetime.now(), status, state, id)
return 'OK',200
@app.route('/jobs/api/worker/<hostname>/schedule', methods=['POST'])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment