provide estimates, format dates better

This commit is contained in:
2021-09-16 19:20:43 +10:00
parent 5db1cf9e32
commit c59e23efda
3 changed files with 15 additions and 5 deletions

8
job.py
View File

@@ -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