fix: code review fixes

This commit is contained in:
Roman 2025-01-14 13:33:41 +08:00
parent 0ec8ce05e1
commit 51dbb0aa1f
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
8 changed files with 44 additions and 4 deletions

Binary file not shown.

View File

@ -1,13 +1,13 @@
nomos_nodes = {
"nomos": {
"image": "nomos:latest",
"volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params.bin:/kzgrs_test_params:z"],
"volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params:/kzgrs_test_params:z"],
"ports": ["3000/udp", "18080/tcp"],
"entrypoint": "/etc/nomos/scripts/run_nomos_node.sh",
},
"nomos_executor": {
"image": "nomos:latest",
"volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params.bin:/kzgrs_test_params:z"],
"volumes": ["cl_config:/etc/nomos", "./kzgrs/kzgrs_test_params:/kzgrs_test_params:z"],
"ports": ["3000/udp", "18080/tcp"],
"entrypoint": "/etc/nomos/scripts/run_nomos_executor.sh",
},

View File

@ -79,6 +79,45 @@ class NomosNode:
logger.debug(f"Container returned {self._container}")
logger.debug(f"Started container from image {self._image_name}. " f"REST: {getattr(self, '_tcp_port', 'N/A')}")
@retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True)
def stop(self):
if self._container:
logger.debug(f"Stopping container with id {self._container.short_id}")
self._container.stop()
try:
self._container.remove()
except:
pass
self._container = None
logger.debug("Container stopped.")
@retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True)
def kill(self):
if self._container:
logger.debug(f"Killing container with id {self._container.short_id}")
self._container.kill()
try:
self._container.remove()
except:
pass
self._container = None
logger.debug("Container killed.")
def restart(self):
if self._container:
logger.debug(f"Restarting container with id {self._container.short_id}")
self._container.restart()
def pause(self):
if self._container:
logger.debug(f"Pausing container with id {self._container.short_id}")
self._container.pause()
def unpause(self):
if self._container:
logger.debug(f"Unpause container with id {self._container.short_id}")
self._container.unpause()
def ensure_ready(self, timeout_duration=10):
@retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(0.1), reraise=True)
def check_ready(node=self):

View File

@ -1,7 +1,6 @@
from src.env_vars import CFGSYNC, NOMOS, NOMOS_EXECUTOR
from src.libs.custom_logger import get_custom_logger
from src.node.nomos_node import NomosNode
from src.libs.common import delay
logger = get_custom_logger(__name__)
@ -24,4 +23,6 @@ class Test2NodeClAlive:
logger.error(f"REST service did not become ready in time: {ex}")
raise
delay(60)
self.node1.stop()
self.node2.stop()
self.node3.stop()