Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
389504fa
Commit
389504fa
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
changed time tracker representation to hh:mm:ss
parent
1dfeaaed
No related branches found
No related tags found
2 merge requests
!24
include recent development
,
!20
not distributed training
Pipeline
#27162
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/helpers.py
+3
-1
3 additions, 1 deletion
src/helpers.py
test/test_helpers.py
+1
-1
1 addition, 1 deletion
test/test_helpers.py
test/test_modules/test_run_environment.py
+4
-2
4 additions, 2 deletions
test/test_modules/test_run_environment.py
with
8 additions
and
4 deletions
src/helpers.py
+
3
−
1
View file @
389504fa
...
@@ -13,6 +13,7 @@ import numpy as np
...
@@ -13,6 +13,7 @@ import numpy as np
import
os
import
os
import
time
import
time
import
socket
import
socket
import
datetime
as
dt
def
to_list
(
arg
):
def
to_list
(
arg
):
...
@@ -116,7 +117,8 @@ class TimeTracking(object):
...
@@ -116,7 +117,8 @@ class TimeTracking(object):
return
time
.
time
()
-
self
.
start
return
time
.
time
()
-
self
.
start
def
__repr__
(
self
):
def
__repr__
(
self
):
return
f
"
{
round
(
self
.
_duration
(),
2
)
}
s
"
# return f"{round(self._duration(), 2)}s"
return
f
"
{
dt
.
timedelta
(
seconds
=
math
.
ceil
(
self
.
_duration
()))
}
(hh:mm:ss)
"
def
run
(
self
):
def
run
(
self
):
self
.
_start
()
self
.
_start
()
...
...
This diff is collapsed.
Click to expand it.
test/test_helpers.py
+
1
−
1
View file @
389504fa
...
@@ -117,7 +117,7 @@ class TestTimeTracking:
...
@@ -117,7 +117,7 @@ class TestTimeTracking:
t
=
TimeTracking
()
t
=
TimeTracking
()
t
.
_end
()
t
.
_end
()
duration
=
t
.
_duration
()
duration
=
t
.
_duration
()
assert
t
.
__repr__
().
rstrip
()
==
f
"
{
round
(
duration
,
2
)
}
s
"
.
rstrip
()
assert
t
.
__repr__
().
rstrip
()
==
f
"
{
dt
.
timedelta
(
seconds
=
math
.
ceil
(
duration
))
}
(hh:mm:ss)
"
.
rstrip
()
def
test_run
(
self
):
def
test_run
(
self
):
t
=
TimeTracking
(
start
=
False
)
t
=
TimeTracking
(
start
=
False
)
...
...
This diff is collapsed.
Click to expand it.
test/test_modules/test_run_environment.py
+
4
−
2
View file @
389504fa
...
@@ -16,7 +16,8 @@ class TestRunEnvironment:
...
@@ -16,7 +16,8 @@ class TestRunEnvironment:
caplog
.
set_level
(
logging
.
INFO
)
caplog
.
set_level
(
logging
.
INFO
)
with
RunEnvironment
()
as
r
:
with
RunEnvironment
()
as
r
:
r
.
do_stuff
(
0.1
)
r
.
do_stuff
(
0.1
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
"
RunEnvironment finished after \d+\.\d+s
"
))
expression
=
PyTestRegex
(
r
"
RunEnvironment finished after \d+:\d+:\d+ \(hh:mm:ss\)
"
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
expression
)
def
test_init
(
self
,
caplog
):
def
test_init
(
self
,
caplog
):
caplog
.
set_level
(
logging
.
INFO
)
caplog
.
set_level
(
logging
.
INFO
)
...
@@ -28,4 +29,5 @@ class TestRunEnvironment:
...
@@ -28,4 +29,5 @@ class TestRunEnvironment:
r
=
RunEnvironment
()
r
=
RunEnvironment
()
r
.
do_stuff
(
0.2
)
r
.
do_stuff
(
0.2
)
del
r
del
r
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
PyTestRegex
(
r
"
RunEnvironment finished after \d+\.\d+s
"
))
expression
=
PyTestRegex
(
r
"
RunEnvironment finished after \d+:\d+:\d+ \(hh:mm:ss\)
"
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
expression
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment