Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
D-GENIES
Commits
d3c46ee6
Commit
d3c46ee6
authored
Feb 05, 2018
by
Floreal Cabanettes
Browse files
Make time human readable for gellery table
parent
5dc64728
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dgenies/lib/functions.py
View file @
d3c46ee6
...
...
@@ -200,6 +200,20 @@ class Functions:
i
+=
1
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
def
get_gallery_items
():
...
...
@@ -212,7 +226,7 @@ class Functions:
"query"
:
item
.
query
,
"target"
:
item
.
target
,
"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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment