Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shreyan Chowdhury
moodwalk
Commits
d4512404
Commit
d4512404
authored
Sep 16, 2019
by
Shreyan Chowdhury
Browse files
add exit_experiment
parent
ba5869eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils.py
View file @
d4512404
...
@@ -124,18 +124,19 @@ def make_run_name(suffix=''):
...
@@ -124,18 +124,19 @@ def make_run_name(suffix=''):
return
name
return
name
CURR_RUN_PATH
=
''
CURR_RUN_PATH
=
''
curr_run_name
=
''
filelog
=
logging
.
getLogger
()
filelog
=
logging
.
getLogger
()
streamlog
=
logging
.
getLogger
()
streamlog
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
def
init_experiment
(
comment
=
''
,
name
=
None
):
def
init_experiment
(
comment
=
''
,
name
=
None
):
global
CURR_RUN_PATH
global
CURR_RUN_PATH
,
curr_run_name
global
filelog
,
streamlog
,
logger
global
filelog
,
streamlog
,
logger
if
name
is
None
:
if
name
is
None
:
curr_run_name
=
make_run_name
(
comment
)
curr_run_name
=
make_run_name
(
comment
)
else
:
else
:
curr_run_name
=
name
curr_run_name
=
name
CURR_RUN_PATH
=
os
.
path
.
join
(
PATH_RESULTS
,
'runs'
,
curr_run_name
)
CURR_RUN_PATH
=
os
.
path
.
join
(
PATH_RESULTS
,
'runs'
,
'running - '
+
curr_run_name
)
if
not
os
.
path
.
isdir
(
CURR_RUN_PATH
):
if
not
os
.
path
.
isdir
(
CURR_RUN_PATH
):
os
.
makedirs
(
CURR_RUN_PATH
)
os
.
makedirs
(
CURR_RUN_PATH
)
...
@@ -162,6 +163,15 @@ def init_experiment(comment='', name=None):
...
@@ -162,6 +163,15 @@ def init_experiment(comment='', name=None):
# ============================================
# ============================================
def
exit_experiment
(
status
):
if
status
==
'failed'
:
os
.
rename
(
CURR_RUN_PATH
,
os
.
path
.
join
(
PATH_RESULTS
,
'runs'
,
'failed - '
+
curr_run_name
))
elif
status
==
'stopped'
:
os
.
rename
(
CURR_RUN_PATH
,
os
.
path
.
join
(
PATH_RESULTS
,
'runs'
,
'stopped - '
+
curr_run_name
))
else
:
os
.
rename
(
CURR_RUN_PATH
,
os
.
path
.
join
(
PATH_RESULTS
,
'runs'
,
curr_run_name
))
def
write_to_file
(
data
,
path
):
def
write_to_file
(
data
,
path
):
# not fully implemented. unused function as of now.
# not fully implemented. unused function as of now.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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