new BUG (very minor), reordered TODOs and now have basic stale job handling - they are detected, and can be cancelled or restarted from GUI

This commit is contained in:
2022-01-11 13:18:21 +11:00
parent bf04c862d6
commit a67c20d72b
6 changed files with 90 additions and 25 deletions

View File

@@ -127,7 +127,7 @@
{% endif %}
{% if GetJM_Message() != None %}
{% set msg=GetJM_Message() %}
{% if request.endpoint != "fix_dups" and request.endpoint != "rm_dups" %}
{% if request.endpoint != "fix_dups" and request.endpoint != "rm_dups" and request.endpoint != "stale_jobs" %}
<div class="py-2 mx-1 alert alert-{{msg.alert}}">
{% if msg.alert != "success" and msg.job.name != "checkdups" %}
<form id="_dismiss" action="{{url_for('clear_jm_msg', id=msg.id)}}" method="POST">

View File

@@ -6,13 +6,26 @@
var active_rows=Array()
var completed_rows=Array()
function HandleStaleJob(id, action)
{
s='<form id="_fm" method="POST" action="/stale_job/' + id + '">'
s+='<input type="hidden" name="action" value="' + action + '">'
s+='</form>'
$(s).appendTo('body').submit();
}
{% for job in jobs %}
{% if job.state == "Failed" %}
row='<tr><td class="table-danger"><a href="{{url_for('joblog', id=job.id)}}">Job #{{job.id}} - {{job.name}}</a>'
{% elif job.state == "Withdrawn" %}
row='<tr><td class="table-secondary"><i><a href="{{url_for('joblog', id=job.id)}}">Job #{{job.id}} - {{job.name}}</a>'
{% else %}
row='<tr><td><a href="{{url_for('joblog', id=job.id)}}">Job #{{job.id}} - {{job.name}}</a>'
row="<tr><td>"
{% if job.pa_job_state == 'Stale' %}
row+='<button class="btn btn-success py-0" onClick="HandleStaleJob({{job.id}}, \'restart\' )">Restart</button>'
row+='<button class="btn btn-danger py-0" onClick="HandleStaleJob({{job.id}}, \'cancel\' )">Cancel</button>&nbsp;&nbsp;'
{% endif %}
row+='<a href="{{url_for('joblog', id=job.id)}}">Job #{{job.id}} - {{job.name}}</a>'
{% endif %}
{% if job.name != "rmdups" %}
{% for ex in job.extra %}
@@ -27,7 +40,10 @@
{% else %}
row+= '</td><td>{{job.start_time|vicdate}}</td><td>'
{% endif %}
{% if job.pa_job_state != "Completed" %}
{% if job.pa_job_state == "Stale" %}
row += 'In Progress</td></tr>'
active_rows.push(row)
{% elif job.pa_job_state != "Completed" %}
{% if job.num_files and job.num_files > 0 %}
{% set prog=(job.current_file_num/job.num_files*100)|round|int %}
row +=`
@@ -52,9 +68,11 @@
<div class="container-fluid">
<h3>{{page_title}}</h3>
<table id="job_tbl" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
{% if 'Stale' not in page_title %}
<thead>
<tr class="table-primary"><th>Active Jobs</th><th>Job Started</th><th>Progress</th></tr>
</thead>
{% endif %}
<tbody id="job_tbl_body">
</tbody>
</table>
@@ -63,8 +81,10 @@
<script>
for(el in active_rows)
$('#job_tbl_body').append(active_rows[el])
{% if 'Stale' not in page_title %}
$('#job_tbl_body').append( '<tr class="table-primary"><th>Completed Jobs</th><th>Job Started</th><th>Job Completed</th></tr>' )
for(el in completed_rows)
$('#job_tbl_body').append(completed_rows[el])
{% endif %}
</script>
{% endblock main_content %}