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
55862cfc
Unverified
Commit
55862cfc
authored
Jan 16, 2025
by
Jakob Görgen
Browse files
symphony/runner: use uuid if runner dir exists + deserialize instantiation
parent
a4f0b9e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
symphony/runner/simbricks/runner/__main__.py
symphony/runner/simbricks/runner/__main__.py
+9
-3
No files found.
symphony/runner/simbricks/runner/__main__.py
View file @
55862cfc
...
...
@@ -25,7 +25,7 @@ import json
import
logging
import
pathlib
import
sys
import
uuid
from
simbricks
import
client
from
simbricks.orchestration.instantiation
import
base
as
inst_base
from
simbricks.orchestration.simulation
import
base
as
sim_base
...
...
@@ -77,6 +77,11 @@ class Runner:
run_obj
=
run_obj_list
[
0
]
run_workdir
=
self
.
_workdir
/
f
"run-
{
run_id
}
"
if
run_workdir
.
exists
():
LOGGER
.
warning
(
f
"the directory
{
run_workdir
}
already exists, will create a new one using a uuid"
)
run_workdir
=
self
.
_workdir
/
f
"run-
{
run_id
}
-
{
str
(
uuid
.
uuid4
())
}
"
run_workdir
.
mkdir
(
parents
=
True
)
inst_obj
=
await
self
.
_sb_client
.
get_instantiation
(
run_obj
[
"instantiation_id"
])
...
...
@@ -85,13 +90,14 @@ class Runner:
system
=
sys_base
.
System
.
fromJSON
(
json
.
loads
(
sys_obj
[
"sb_json"
]))
simulation
=
sim_base
.
Simulation
.
fromJSON
(
system
,
json
.
loads
(
sim_obj
[
"sb_json"
]))
tmp_inst
=
inst_base
.
Instantiation
.
fromJSON
(
simulation
,
json
.
loads
(
inst_obj
[
"sb_json"
]))
env
=
inst_base
.
InstantiationEnvironment
(
workdir
=
run_workdir
)
# TODO
inst
=
inst_base
.
Instantiation
(
sim
=
simulation
)
inst
.
env
=
env
inst
.
preserve_tmp_folder
=
False
inst
.
create_checkpoint
=
True
#
inst.artifact_
paths = [f"{run_workdir}/output"] # create an
artifact
inst
.
artifact_paths
=
[]
# create NO
artifact
inst
.
artifact_
name
=
tmp_inst
.
artifact
_name
inst
.
artifact_paths
=
tmp_inst
.
artifact
_paths
return
inst
async
def
_prepare_run
(
self
,
run_id
:
int
)
->
Run
:
...
...
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