Skip to content
Snippets Groups Projects
Commit d714fd78 authored by Andreas Valder's avatar Andreas Valder
Browse files

added option to restart all failed jobs

parent 97092955
No related branches found
No related tags found
No related merge requests found
......@@ -37,9 +37,12 @@ def jobs_overview():
@app.route('/internal/jobs/action/<action>')
@mod_required
@csrf_protect
def jobs_action(action):
def jobs_action(action, jobid=None):
print(jobid)
if action == 'clear_failed':
query('UPDATE jobs SET state="deleted" WHERE state="failed"')
query('UPDATE jobs SET state="deleted" WHERE state = "failed" AND (id = ? OR ? IS NULL)',jobid, jobid)
if action == 'retry_failed':
query('UPDATE jobs SET state="ready" WHERE state = "failed" AND (id = ? OR ? IS NULL)', jobid, jobid)
return redirect(request.values.get('ref', url_for('jobs_overview')))
def jobs_api_token_required(func):
......
......@@ -38,6 +38,7 @@
Jobs
<a class="btn btn-default">Job(s) erzeugen</a>
<a class="btn btn-default" href="{{url_for('jobs_action', action='clear_failed', ref=request.url)}}" >Alle fehlgeschlagenen Jobs löschen</a>
<a class="btn btn-default" href="{{url_for('jobs_action', action='retry_failed', ref=request.url)}}" >Alle fehlgeschlagenen Jobs neustarten</a>
</h1>
</div>
<div class="panel-collapse collapse in">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment