Commit d3c46ee6 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Make time human readable for gellery table

parent 5dc64728
...@@ -200,6 +200,20 @@ class Functions: ...@@ -200,6 +200,20 @@ class Functions:
i += 1 i += 1
return "%.1f %s" % (size, units[i]) return "%.1f %s" % (size, units[i])
@staticmethod
def get_readable_time(seconds):
time_r = "%d s" % seconds
if seconds >= 60:
minutes = seconds // 60
seconds = seconds - (minutes * 60)
time_r = "%d min %d s" % (minutes, seconds)
if minutes >= 60:
hours = minutes // 60
minutes = minutes - (hours * 60)
time_r = "%d h %d min %d s" % (hours, minutes, seconds)
return time_r
@staticmethod @staticmethod
def get_gallery_items(): def get_gallery_items():
...@@ -212,7 +226,7 @@ class Functions: ...@@ -212,7 +226,7 @@ class Functions:
"query": item.query, "query": item.query,
"target": item.target, "target": item.target,
"mem_peak": Functions.get_readable_size(item.job.mem_peak), "mem_peak": Functions.get_readable_size(item.job.mem_peak),
"time_elapsed": item.job.time_elapsed "time_elapsed": Functions.get_readable_time(item.job.time_elapsed)
}) })
return items return items
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment