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
44a70581
Commit
44a70581
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
name attribute in time tracking
parent
015c3f87
No related branches found
No related tags found
2 merge requests
!59
Develop
,
!52
implemented bootstraps
Pipeline
#30491
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/helpers.py
+3
-2
3 additions, 2 deletions
src/helpers.py
test/test_helpers.py
+8
-0
8 additions, 0 deletions
test/test_helpers.py
with
11 additions
and
2 deletions
src/helpers.py
+
3
−
2
View file @
44a70581
...
@@ -49,9 +49,10 @@ class TimeTracking(object):
...
@@ -49,9 +49,10 @@ class TimeTracking(object):
method. Duration can always be shown by printing the time tracking object or calling get_current_duration.
method. Duration can always be shown by printing the time tracking object or calling get_current_duration.
"""
"""
def
__init__
(
self
,
start
=
True
):
def
__init__
(
self
,
start
=
True
,
name
=
"
undefined job
"
):
self
.
start
=
None
self
.
start
=
None
self
.
end
=
None
self
.
end
=
None
self
.
_name
=
name
if
start
:
if
start
:
self
.
_start
()
self
.
_start
()
...
@@ -93,7 +94,7 @@ class TimeTracking(object):
...
@@ -93,7 +94,7 @@ class TimeTracking(object):
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
self
.
stop
()
self
.
stop
()
logging
.
info
(
f
"
undefined job
finished after
{
self
}
"
)
logging
.
info
(
f
"
{
self
.
_name
}
finished after
{
self
}
"
)
def
prepare_host
(
create_new
=
True
,
sampling
=
"
daily
"
):
def
prepare_host
(
create_new
=
True
,
sampling
=
"
daily
"
):
...
...
This diff is collapsed.
Click to expand it.
test/test_helpers.py
+
8
−
0
View file @
44a70581
...
@@ -117,6 +117,14 @@ class TestTimeTracking:
...
@@ -117,6 +117,14 @@ class TestTimeTracking:
expression
=
PyTestRegex
(
r
"
undefined job finished after \d+:\d+:\d+ \(hh:mm:ss\)
"
)
expression
=
PyTestRegex
(
r
"
undefined job finished after \d+:\d+:\d+ \(hh:mm:ss\)
"
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
expression
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
expression
)
def
test_name_enter_exit
(
self
,
caplog
):
caplog
.
set_level
(
logging
.
INFO
)
with
TimeTracking
(
name
=
"
my job
"
)
as
t
:
assert
t
.
start
is
not
None
assert
t
.
end
is
None
expression
=
PyTestRegex
(
r
"
my job finished after \d+:\d+:\d+ \(hh:mm:ss\)
"
)
assert
caplog
.
record_tuples
[
-
1
]
==
(
'
root
'
,
20
,
expression
)
class
TestPrepareHost
:
class
TestPrepareHost
:
...
...
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