Skip to content

Commit

Permalink
account correctly for day of year (h2oai#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-pfeiffer authored Jul 13, 2023
1 parent 97e8e92 commit e35d9d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,9 +1348,12 @@ def get_experiments_info(df: DataFrame, q: Q) -> DefaultDict:
if eta == 0:
eta = ""
else:
# if more than one day, show days
# need to subtract 1 day from time_took since strftime shows
# day of year which starts counting at 1
if eta > 86400:
eta = time.strftime(
"%-jd %H:%M:%S", time.gmtime(float(eta))
"%-jd %H:%M:%S", time.gmtime(float(eta - 86400))
)
else:
eta = time.strftime("%H:%M:%S", time.gmtime(float(eta)))
Expand Down
5 changes: 4 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,11 @@ def run(cfg: Any) -> None:
write_flag(flag_path, "status", "finished")
time_took = time.time() - global_start_time
if time_took > 86400:
# if more than one day, show days
# need to subtract 1 day from time_took since strftime shows day of year
# which starts counting at 1
time_took_formatted = time.strftime(
"%-jd %H:%M:%S", time.gmtime(float(time_took))
"%-jd %H:%M:%S", time.gmtime(float(time_took - 86400))
)
else:
time_took_formatted = time.strftime(
Expand Down

0 comments on commit e35d9d6

Please sign in to comment.