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
254fae55
Commit
254fae55
authored
Jul 06, 2021
by
Antoine Kaufmann
Browse files
experiments: remove run_exp_local and use async interface from LocalSimpleRuntime
parent
bef83738
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
experiments/simbricks/experiments.py
experiments/simbricks/experiments.py
+1
-7
experiments/simbricks/runtime/local.py
experiments/simbricks/runtime/local.py
+11
-8
No files found.
experiments/simbricks/experiments.py
View file @
254fae55
...
...
@@ -254,10 +254,4 @@ class ExpOutput(object):
self
.
sims
[
sim
.
full_name
()]
=
obj
def
dumps
(
self
):
return
json
.
dumps
(
self
.
__dict__
)
def
run_exp_local
(
exp
,
env
,
verbose
=
False
):
asyncio
.
run
(
exp
.
prepare
(
env
,
verbose
=
verbose
))
return
asyncio
.
run
(
exp
.
run
(
env
,
verbose
=
verbose
))
return
json
.
dumps
(
self
.
__dict__
)
\ No newline at end of file
experiments/simbricks/runtime/local.py
View file @
254fae55
...
...
@@ -35,16 +35,19 @@ class LocalSimpleRuntime(Runtime):
def
add_run
(
self
,
run
):
self
.
runnable
.
append
(
run
)
async
def
do_run
(
self
,
run
):
run
.
prep_dirs
()
await
run
.
experiment
.
prepare
(
run
.
env
,
verbose
=
self
.
verbose
)
run
.
output
=
await
run
.
experiment
.
run
(
run
.
env
,
verbose
=
self
.
verbose
)
self
.
complete
.
append
(
run
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
with
open
(
run
.
outpath
,
'w'
)
as
f
:
f
.
write
(
run
.
output
.
dumps
())
def
start
(
self
):
for
run
in
self
.
runnable
:
run
.
prep_dirs
()
run
.
output
=
exp
.
run_exp_local
(
run
.
experiment
,
run
.
env
,
verbose
=
self
.
verbose
)
self
.
complete
.
append
(
run
)
pathlib
.
Path
(
run
.
outpath
).
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
with
open
(
run
.
outpath
,
'w'
)
as
f
:
f
.
write
(
run
.
output
.
dumps
())
asyncio
.
run
(
self
.
do_run
(
run
))
class
LocalParallelRuntime
(
Runtime
):
...
...
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