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
9bc43bf7
Commit
9bc43bf7
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
add log file counter
parent
a3f714b7
No related branches found
No related tags found
3 merge requests
!90
WIP: new release update
,
!89
Resolve "release branch / CI on gpu"
,
!83
Resolve "logging with counter"
Pipeline
#32764
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/run_modules/run_environment.py
+15
-5
15 additions, 5 deletions
src/run_modules/run_environment.py
with
15 additions
and
5 deletions
src/run_modules/run_environment.py
+
15
−
5
View file @
9bc43bf7
...
...
@@ -39,11 +39,7 @@ class RunEnvironment(object):
logging
.
info
(
f
"
{
self
.
__class__
.
__name__
}
finished after
{
self
.
time
}
"
)
self
.
del_by_exit
=
True
if
self
.
__class__
.
__name__
==
"
RunEnvironment
"
:
try
:
new_file
=
os
.
path
.
join
(
self
.
data_store
.
get
(
"
experiment_path
"
),
"
logging.log
"
)
shutil
.
copyfile
(
self
.
logger
.
log_file
,
new_file
)
except
(
NameNotFoundInDataStore
,
FileNotFoundError
):
pass
self
.
__copy_log_file
()
self
.
data_store
.
clear_data_store
()
def
__enter__
(
self
):
...
...
@@ -52,6 +48,20 @@ class RunEnvironment(object):
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
self
.
__del__
()
def
__copy_log_file
(
self
):
try
:
counter
=
0
filename_pattern
=
os
.
path
.
join
(
self
.
data_store
.
get
(
"
experiment_path
"
),
"
logging_%03i.log
"
)
new_file
=
filename_pattern
%
counter
while
os
.
path
.
exists
(
new_file
):
counter
+=
1
new_file
=
filename_pattern
%
counter
logging
.
info
(
f
"
Copy log file to
{
new_file
}
"
)
shutil
.
copyfile
(
self
.
logger
.
log_file
,
new_file
)
except
(
NameNotFoundInDataStore
,
FileNotFoundError
):
pass
@staticmethod
def
do_stuff
(
length
=
2
):
time
.
sleep
(
length
)
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