Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
bffe71e4
Commit
bffe71e4
authored
Nov 05, 2020
by
Antoine Kaufmann
Browse files
experiments: remove existing work & checkpoint directory before starting
parent
a7a6ba8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
experiments/modes/runtime.py
experiments/modes/runtime.py
+11
-5
No files found.
experiments/modes/runtime.py
View file @
bffe71e4
...
@@ -2,6 +2,7 @@ import asyncio
...
@@ -2,6 +2,7 @@ import asyncio
import
pickle
import
pickle
import
os
import
os
import
pathlib
import
pathlib
import
shutil
import
re
import
re
import
modes.experiments
as
exp
import
modes.experiments
as
exp
...
@@ -18,6 +19,14 @@ class Run(object):
...
@@ -18,6 +19,14 @@ class Run(object):
def
name
(
self
):
def
name
(
self
):
return
self
.
experiment
.
name
+
'.'
+
str
(
self
.
index
)
return
self
.
experiment
.
name
+
'.'
+
str
(
self
.
index
)
def
prep_dirs
(
self
):
shutil
.
rmtree
(
self
.
env
.
workdir
,
ignore_errors
=
True
)
if
self
.
env
.
create_cp
:
shutil
.
rmtree
(
self
.
env
.
cpdir
,
ignore_errors
=
True
)
pathlib
.
Path
(
self
.
env
.
workdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
pathlib
.
Path
(
self
.
env
.
cpdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
class
Runtime
(
object
):
class
Runtime
(
object
):
def
add_run
(
self
,
run
):
def
add_run
(
self
,
run
):
pass
pass
...
@@ -37,9 +46,7 @@ class LocalSimpleRuntime(Runtime):
...
@@ -37,9 +46,7 @@ class LocalSimpleRuntime(Runtime):
def
start
(
self
):
def
start
(
self
):
for
run
in
self
.
runnable
:
for
run
in
self
.
runnable
:
pathlib
.
Path
(
run
.
env
.
workdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
run
.
prep_dirs
()
pathlib
.
Path
(
run
.
env
.
cpdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
run
.
output
=
exp
.
run_exp_local
(
run
.
experiment
,
run
.
env
,
run
.
output
=
exp
.
run_exp_local
(
run
.
experiment
,
run
.
env
,
verbose
=
self
.
verbose
)
verbose
=
self
.
verbose
)
self
.
complete
.
append
(
run
)
self
.
complete
.
append
(
run
)
...
@@ -72,8 +79,7 @@ class LocalParallelRuntime(Runtime):
...
@@ -72,8 +79,7 @@ class LocalParallelRuntime(Runtime):
async
def
do_run
(
self
,
run
):
async
def
do_run
(
self
,
run
):
''' actually starts a run '''
''' actually starts a run '''
pathlib
.
Path
(
run
.
env
.
workdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
run
.
prep_dirs
()
pathlib
.
Path
(
run
.
env
.
cpdir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
await
run
.
experiment
.
prepare
(
run
.
env
,
verbose
=
self
.
verbose
)
await
run
.
experiment
.
prepare
(
run
.
env
,
verbose
=
self
.
verbose
)
print
(
'starting run '
,
run
.
name
())
print
(
'starting run '
,
run
.
name
())
...
...
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