Commit d714fd78 authored by Andreas Valder's avatar Andreas Valder
Browse files

added option to restart all failed jobs

parent 97092955
...@@ -37,9 +37,12 @@ def jobs_overview(): ...@@ -37,9 +37,12 @@ def jobs_overview():
@app.route('/internal/jobs/action/<action>') @app.route('/internal/jobs/action/<action>')
@mod_required @mod_required
@csrf_protect @csrf_protect
def jobs_action(action): def jobs_action(action, jobid=None):
print(jobid)
if action == 'clear_failed': 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'))) return redirect(request.values.get('ref', url_for('jobs_overview')))
def jobs_api_token_required(func): def jobs_api_token_required(func):
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
Jobs Jobs
<a class="btn btn-default">Job(s) erzeugen</a> <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='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> </h1>
</div> </div>
<div class="panel-collapse collapse in"> <div class="panel-collapse collapse in">
......
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