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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
fb9136eb
Commit
fb9136eb
authored
4 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
run environment can be named by kwarg name, this applies for instance for a Workflow
parent
d6f4c6d8
Branches
Branches containing commit
Tags
Tags containing commit
4 merge requests
!156
include current development into release
,
!155
Resolve "new release v0.12.1"
,
!149
Resolve "mlair started not appearing"
,
!139
Draft: Resolve "KZ filter"
Pipeline
#46154
passed
4 years ago
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mlair/run_modules/run_environment.py
+6
-5
6 additions, 5 deletions
mlair/run_modules/run_environment.py
mlair/workflows/abstract_workflow.py
+3
-2
3 additions, 2 deletions
mlair/workflows/abstract_workflow.py
with
9 additions
and
7 deletions
mlair/run_modules/run_environment.py
+
6
−
5
View file @
fb9136eb
...
@@ -92,17 +92,18 @@ class RunEnvironment(object):
...
@@ -92,17 +92,18 @@ class RunEnvironment(object):
logger
=
None
logger
=
None
tracker_list
=
[]
tracker_list
=
[]
def
__init__
(
self
):
def
__init__
(
self
,
name
=
None
):
"""
Start time tracking automatically and logs as info.
"""
"""
Start time tracking automatically and logs as info.
"""
if
RunEnvironment
.
data_store
is
None
:
if
RunEnvironment
.
data_store
is
None
:
RunEnvironment
.
data_store
=
DataStoreObject
()
RunEnvironment
.
data_store
=
DataStoreObject
()
if
RunEnvironment
.
logger
is
None
:
if
RunEnvironment
.
logger
is
None
:
RunEnvironment
.
logger
=
Logger
()
RunEnvironment
.
logger
=
Logger
()
self
.
time
=
TimeTracking
()
self
.
_name
=
name
if
name
is
not
None
else
self
.
__class__
.
__name__
logging
.
info
(
f
"
{
self
.
__class__
.
__name__
}
started
"
)
self
.
time
=
TimeTracking
(
name
=
name
)
logging
.
info
(
f
"
{
self
.
_name
}
started
"
)
# atexit.register(self.__del__)
# atexit.register(self.__del__)
self
.
data_store
.
tracker
.
append
({})
self
.
data_store
.
tracker
.
append
({})
self
.
tracker_list
.
extend
([{
self
.
_
_class__
.
__
name
__
:
self
.
data_store
.
tracker
[
-
1
]}])
self
.
tracker_list
.
extend
([{
self
.
_name
:
self
.
data_store
.
tracker
[
-
1
]}])
def
__del__
(
self
):
def
__del__
(
self
):
"""
"""
...
@@ -114,7 +115,7 @@ class RunEnvironment(object):
...
@@ -114,7 +115,7 @@ class RunEnvironment(object):
"""
"""
if
not
self
.
del_by_exit
:
if
not
self
.
del_by_exit
:
self
.
time
.
stop
()
self
.
time
.
stop
()
logging
.
info
(
f
"
{
self
.
_
_class__
.
__
name
__
}
finished after
{
self
.
time
}
"
)
logging
.
info
(
f
"
{
self
.
_name
}
finished after
{
self
.
time
}
"
)
self
.
del_by_exit
=
True
self
.
del_by_exit
=
True
# copy log file and clear data store only if called as base class and not as super class
# copy log file and clear data store only if called as base class and not as super class
if
self
.
__class__
.
__name__
==
"
RunEnvironment
"
:
if
self
.
__class__
.
__name__
==
"
RunEnvironment
"
:
...
...
This diff is collapsed.
Click to expand it.
mlair/workflows/abstract_workflow.py
+
3
−
2
View file @
fb9136eb
...
@@ -15,8 +15,9 @@ class Workflow:
...
@@ -15,8 +15,9 @@ class Workflow:
method is sufficient. It must be taken care for inter-stage dependencies, this workflow class only handles the
method is sufficient. It must be taken care for inter-stage dependencies, this workflow class only handles the
execution but not the dependencies (workflow would probably fail in this case).
"""
execution but not the dependencies (workflow would probably fail in this case).
"""
def
__init__
(
self
):
def
__init__
(
self
,
name
=
None
):
self
.
_registry
=
OrderedDict
()
self
.
_registry
=
OrderedDict
()
self
.
_name
=
name
if
name
is
not
None
else
self
.
__class__
.
__name__
def
add
(
self
,
stage
,
**
kwargs
):
def
add
(
self
,
stage
,
**
kwargs
):
"""
Add a new stage with optional kwargs.
"""
"""
Add a new stage with optional kwargs.
"""
...
@@ -24,6 +25,6 @@ class Workflow:
...
@@ -24,6 +25,6 @@ class Workflow:
def
run
(
self
):
def
run
(
self
):
"""
Run workflow embedded in a run environment and according to the stage
'
s ordering.
"""
"""
Run workflow embedded in a run environment and according to the stage
'
s ordering.
"""
with
RunEnvironment
():
with
RunEnvironment
(
name
=
self
.
_name
):
for
stage
,
kwargs
in
self
.
_registry
.
items
():
for
stage
,
kwargs
in
self
.
_registry
.
items
():
stage
(
**
kwargs
)
stage
(
**
kwargs
)
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