diff --git a/job.py b/job.py index fc2d585..98b2443 100644 --- a/job.py +++ b/job.py @@ -135,7 +135,8 @@ def joblog(id): duration= duration-timedelta(microseconds=duration.microseconds) estimate=None duration_s = duration.total_seconds() - if duration_s > 300 and joblog.pa_job_state != "Completed": + # if job is old, not completed, and we have num_files and current_file_num > 0 so we can work out an estimated duration + if duration_s > 300 and joblog.pa_job_state != "Completed" and joblog.current_file_num and joblog.num_files: estimate_s = duration_s / joblog.current_file_num * joblog.num_files estimate = timedelta( seconds=(estimate_s-duration_s) ) estimate = estimate - timedelta(microseconds=estimate.microseconds)