provide estimates, format dates better
This commit is contained in:
8
job.py
8
job.py
@@ -134,7 +134,13 @@ def joblog(id):
|
||||
else:
|
||||
duration=(datetime.now(pytz.utc)-joblog.start_time)
|
||||
duration= duration-timedelta(microseconds=duration.microseconds)
|
||||
return render_template("joblog.html", job=joblog, logs=logs, log_cnt=log_cnt, duration=duration, page_title=page_title, first_logs_only=first_logs_only)
|
||||
estimate=None
|
||||
duration_s = duration.total_seconds()
|
||||
if duration_s > 300 and joblog.pa_job_state != "Completed":
|
||||
estimate_s = duration_s / joblog.current_file_num * joblog.num_files
|
||||
estimate = timedelta( seconds=(estimate_s-duration_s) )
|
||||
estimate = estimate - timedelta(microseconds=estimate.microseconds)
|
||||
return render_template("joblog.html", job=joblog, logs=logs, log_cnt=log_cnt, duration=duration, page_title=page_title, first_logs_only=first_logs_only, estimate=estimate)
|
||||
|
||||
###############################################################################
|
||||
# /job/<id> -> GET -> shows status/history of jobs
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
<dt class="col-2">Start Time:</dt>
|
||||
<dd class="col-10">{{job.start_time|vicdate}}</dt>
|
||||
<dt class="col-2">Duration:</dt>
|
||||
<dd class="col-10">{{duration}}</dd>
|
||||
<dd class="col-10">{{duration}}
|
||||
{% if estimate != None %}
|
||||
(estimated time remaining: {{estimate}})
|
||||
{% endif %}
|
||||
</dd>
|
||||
<dt class="col-2">Last Update:</dt>
|
||||
<dd class="col-10">{{job.last_update|vicdate}}</dd>
|
||||
<dt class="col-2">Current state:</dt>
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
{% endif %}
|
||||
|
||||
{% if job.state == "Withdrawn" %}
|
||||
row+= '</td><td>{{job.start_time}}</i></td><td>'
|
||||
row+= '</td><td>{{job.start_time|vicdate}}</i></td><td>'
|
||||
{% else %}
|
||||
row+= '</td><td>{{job.start_time}}</td><td>'
|
||||
row+= '</td><td>{{job.start_time|vicdate}}</td><td>'
|
||||
{% endif %}
|
||||
{% if job.pa_job_state != "Completed" %}
|
||||
{% if job.num_files and job.num_files > 0 %}
|
||||
@@ -43,7 +43,7 @@
|
||||
{% endif %}
|
||||
active_rows.push(row)
|
||||
{% else %}
|
||||
row += '{{job.last_update}}</td></td></tr>'
|
||||
row += '{{job.last_update|vicdate}}</td></td></tr>'
|
||||
completed_rows.push(row)
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user