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
31b07726
"vscode:/vscode.git/clone" did not exist on "aa9e2e56bf1a2fa417db42f7d63fb9fa86ad783b"
Unverified
Commit
31b07726
authored
Sep 25, 2024
by
Jakob Görgen
Browse files
more sane default environment paths
parent
2735154e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
experiments/simbricks/orchestration/instantiation/base.py
experiments/simbricks/orchestration/instantiation/base.py
+27
-11
No files found.
experiments/simbricks/orchestration/instantiation/base.py
View file @
31b07726
...
@@ -57,27 +57,40 @@ class InstantiationEnvironment(util_base.IdObj):
...
@@ -57,27 +57,40 @@ class InstantiationEnvironment(util_base.IdObj):
def
__init__
(
def
__init__
(
self
,
self
,
repo_path
:
str
=
pathlib
.
Path
(
__file__
).
parents
[
3
].
resolve
(),
repo_path
:
str
=
pathlib
.
Path
(
__file__
).
parents
[
3
].
resolve
(),
workdir
:
str
=
pathlib
.
Path
().
resolve
(),
workdir
:
str
|
None
=
None
,
cpdir
:
str
=
pathlib
.
Path
().
resolve
(),
output_base
:
str
|
None
=
None
,
cpdir
:
str
|
None
=
None
,
create_cp
:
bool
=
False
,
create_cp
:
bool
=
False
,
restore_cp
:
bool
=
False
,
restore_cp
:
bool
=
False
,
shm_base
:
str
=
pathlib
.
Path
().
resolve
(),
shm_base
:
str
|
None
=
None
,
output_base
:
str
=
pathlib
.
Path
().
resolve
(),
tmp_simulation_files
:
str
|
None
=
None
,
tmp_simulation_files
:
str
=
pathlib
.
Path
().
resolve
(),
qemu_img_path
:
str
|
None
=
None
,
qemu_img_path
:
str
|
None
=
None
,
qemu_path
:
str
|
None
=
None
,
qemu_path
:
str
|
None
=
None
,
):
):
super
().
__init__
()
super
().
__init__
()
# TODO: add more parameters that wont change during instantiation
self
.
_repodir
:
str
=
pathlib
.
Path
(
repo_path
).
absolute
()
self
.
_repodir
:
str
=
pathlib
.
Path
(
repo_path
).
absolute
()
self
.
_workdir
:
str
=
pathlib
.
Path
(
workdir
).
absolute
()
self
.
_workdir
:
str
=
(
self
.
_cpdir
:
str
=
pathlib
.
Path
(
cpdir
).
absolute
()
workdir
self
.
_shm_base
:
str
=
pathlib
.
Path
(
self
.
_workdir
).
joinpath
(
shm_base
).
absolute
()
if
workdir
else
pathlib
.
Path
(
f
"
{
self
.
_repodir
}
/experiment-wrkdir"
).
absolute
()
)
self
.
_output_base
:
str
=
(
self
.
_output_base
:
str
=
(
pathlib
.
Path
(
self
.
_workdir
).
joinpath
(
output_base
).
absolute
()
output_base
if
output_base
else
pathlib
.
Path
(
f
"
{
self
.
_workdir
}
/output"
).
absolute
()
)
self
.
_cpdir
:
str
=
(
cpdir
if
cpdir
else
pathlib
.
Path
(
f
"
{
self
.
_output_base
}
/checkpoints"
).
absolute
()
)
self
.
_shm_base
:
str
=
(
shm_base
if
shm_base
else
pathlib
.
Path
(
f
"
{
self
.
_workdir
}
/shm"
).
absolute
()
)
)
self
.
_tmp_simulation_files
:
str
=
(
self
.
_tmp_simulation_files
:
str
=
(
pathlib
.
Path
(
self
.
_workdir
).
joinpath
(
tmp_simulation_files
).
absolute
()
tmp_simulation_files
if
tmp_simulation_files
else
(
pathlib
.
Path
(
f
"
{
self
.
_workdir
}
/tmp"
).
absolute
())
)
)
self
.
_create_cp
:
bool
=
create_cp
self
.
_create_cp
:
bool
=
create_cp
self
.
_restore_cp
:
bool
=
restore_cp
self
.
_restore_cp
:
bool
=
restore_cp
...
@@ -276,14 +289,17 @@ class Instantiation(util_base.IdObj):
...
@@ -276,14 +289,17 @@ class Instantiation(util_base.IdObj):
async
def
prepare
(
self
)
->
None
:
async
def
prepare
(
self
)
->
None
:
wrkdir
=
self
.
wrkdir
()
wrkdir
=
self
.
wrkdir
()
print
(
f
"wrkdir=
{
wrkdir
}
"
)
shutil
.
rmtree
(
wrkdir
,
ignore_errors
=
True
)
shutil
.
rmtree
(
wrkdir
,
ignore_errors
=
True
)
await
self
.
executor
.
rmtree
(
wrkdir
)
await
self
.
executor
.
rmtree
(
wrkdir
)
shm_base
=
self
.
shm_base_dir
()
shm_base
=
self
.
shm_base_dir
()
print
(
f
"shm_base=
{
shm_base
}
"
)
shutil
.
rmtree
(
shm_base
,
ignore_errors
=
True
)
shutil
.
rmtree
(
shm_base
,
ignore_errors
=
True
)
await
self
.
executor
.
rmtree
(
shm_base
)
await
self
.
executor
.
rmtree
(
shm_base
)
cpdir
=
self
.
cpdir
()
cpdir
=
self
.
cpdir
()
print
(
f
"cpdir=
{
cpdir
}
"
)
if
self
.
create_cp
():
if
self
.
create_cp
():
shutil
.
rmtree
(
cpdir
,
ignore_errors
=
True
)
shutil
.
rmtree
(
cpdir
,
ignore_errors
=
True
)
await
self
.
executor
.
rmtree
(
cpdir
)
await
self
.
executor
.
rmtree
(
cpdir
)
...
...
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