prevent div by zero error, when job is > 5 minutes, and no progress yet
This commit is contained in:
3
job.py
3
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)
|
||||
|
||||
Reference in New Issue
Block a user