"...git@developer.sourcefind.cn:OpenDAS/mmdetection3d.git" did not exist on "dabf0a2614fb9c353577c1437065fc523fa47495"
Commit 02b52dbf authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

nodeconfig.py: improve doc strings for classes NodeConfig and AppConfig

parent 9f3bac00
...@@ -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.""" restored."""
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'
"""Disk image to use.""" """Name of disk 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'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment