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
02b52dbf
Commit
02b52dbf
authored
Aug 13, 2023
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Sep 04, 2023
Browse files
nodeconfig.py: improve doc strings for classes NodeConfig and AppConfig
parent
9f3bac00
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
17 deletions
+37
-17
experiments/simbricks/orchestration/nodeconfig.py
experiments/simbricks/orchestration/nodeconfig.py
+37
-17
No files found.
experiments/simbricks/orchestration/nodeconfig.py
View file @
02b52dbf
...
@@ -40,23 +40,28 @@ class AppConfig():
...
@@ -40,23 +40,28 @@ class AppConfig():
return
[]
return
[]
def
prepare_post_cp
(
self
)
->
tp
.
List
[
str
]:
def
prepare_post_cp
(
self
)
->
tp
.
List
[
str
]:
"""Commands to run to prepare this application after checkpoint
"""Commands to run to prepare this application after
the
checkpoint
is
restore."""
restore
d
."""
return
[]
return
[]
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
"""
"""
Additional files to put inside the node,
for example, necessary config
Additional files to put inside the node,
which are mounted under
files or kernel modules
.
`/tmp/guest/`
.
Specified in the following format: `filename_inside_node`:
`IO_handle_to
Specified in the following format: `filename_inside_node`:
read
_file`
`IO_handle_of
_file`
"""
"""
return
{}
return
{}
def
strfile
(
self
,
s
:
str
):
def
strfile
(
self
,
s
:
str
):
"""Helper function to convert a string to an IO handle for usage in
"""
`config_files()`."""
Helper function to convert a string to an IO handle for usage in
`config_files()`.
Using this, you can create a file with the string as its content on the
node.
"""
return
io
.
BytesIO
(
bytes
(
s
,
encoding
=
'UTF-8'
))
return
io
.
BytesIO
(
bytes
(
s
,
encoding
=
'UTF-8'
))
...
@@ -65,7 +70,12 @@ class NodeConfig():
...
@@ -65,7 +70,12 @@ class NodeConfig():
def
__init__
(
self
):
def
__init__
(
self
):
self
.
sim
=
'qemu'
self
.
sim
=
'qemu'
"""Name of simulator to run."""
"""The concrete simulator that runs this node config. This is used to
use execute different commands depending on the concrete simulator,
e.g., which command to use to end the simulation.
TODO(Kaufi-Jonas): This is ugly. Refactor necessary commands to be
provided by the simulator's class directly."""
self
.
ip
=
'10.0.0.1'
self
.
ip
=
'10.0.0.1'
"""IP address."""
"""IP address."""
self
.
prefix
=
24
self
.
prefix
=
24
...
@@ -77,11 +87,16 @@ class NodeConfig():
...
@@ -77,11 +87,16 @@ class NodeConfig():
self
.
memory
=
8
*
1024
self
.
memory
=
8
*
1024
"""Amount of system memory in MB."""
"""Amount of system memory in MB."""
self
.
disk_image
=
'base'
self
.
disk_image
=
'base'
"""
D
isk image to use."""
"""
Name of d
isk image to use."""
self
.
mtu
=
1500
self
.
mtu
=
1500
"""Networking MTU."""
"""Networking MTU."""
self
.
nockp
=
0
self
.
nockp
=
0
"""Do not make checkpoint in Gem5."""
"""Do not create a checkpoint in Gem5.
TODO(Kaufi-Jonas): Seems we don't need this anymore since we specify
whether to take a checkpoint experiment-wide. Otherwise, refactor this
into simulator-specific class.
"""
self
.
app
:
tp
.
Optional
[
AppConfig
]
=
None
self
.
app
:
tp
.
Optional
[
AppConfig
]
=
None
"""Application to run on simulated host."""
"""Application to run on simulated host."""
self
.
kcmd_append
=
''
self
.
kcmd_append
=
''
...
@@ -146,17 +161,22 @@ class NodeConfig():
...
@@ -146,17 +161,22 @@ class NodeConfig():
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
def
config_files
(
self
)
->
tp
.
Dict
[
str
,
tp
.
IO
]:
"""
"""
Additional files to put inside the node,
for example, necessary config
Additional files to put inside the node,
which are mounted under
files or kernel modules
.
`/tmp/guest/`
.
Specified in the following format: `filename_inside_node`:
`IO_handle_to
Specified in the following format: `filename_inside_node`:
read
_file`
`IO_handle_of
_file`
"""
"""
return
self
.
app
.
config_files
()
return
self
.
app
.
config_files
()
def
strfile
(
self
,
s
:
str
):
def
strfile
(
self
,
s
:
str
):
"""Helper function to convert a string to an IO handle for usage in
"""
`config_files()`."""
Helper function to convert a string to an IO handle for usage in
`config_files()`.
Using this, you can create a file with the string as its content on the
node.
"""
return
io
.
BytesIO
(
bytes
(
s
,
encoding
=
'UTF-8'
))
return
io
.
BytesIO
(
bytes
(
s
,
encoding
=
'UTF-8'
))
...
...
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