Skip to content

Commit

Permalink
chore: fix wrong stressor init in validator
Browse files Browse the repository at this point in the history
Signed-off-by: Huamin Chen <[email protected]>
  • Loading branch information
rootfs committed Nov 14, 2024
1 parent 9f9aefb commit f1aa2e5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion e2e/tools/validator/src/validator/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ def stress(cfg: config.Validator, script_path: str, report_dir: str):

click.secho(" * Running stress test ...", fg="green")
remote = Remote(cfg.remote)
stress_test = remote.run_script(script_path)
total_runtime_seconds = cfg.stressor.total_runtime_seconds
curve_type = cfg.stressor.curve_type
stress_test = remote.run_script(script_path = script_path, total_runtime_seconds = total_runtime_seconds, curve_type = curve_type)
res.start_time = stress_test.start_time
res.end_time = stress_test.end_time

Expand Down
6 changes: 2 additions & 4 deletions e2e/tools/validator/src/validator/stresser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ def __init__(self, config: config.Remote):
self.user = config.user
self.port = config.port
self.password = config.password
self.total_runtime_seconds = config.total_runtime_seconds
self.curve_type = config.curve_type

self.ssh_client = paramiko.SSHClient()
self.ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
Expand Down Expand Up @@ -65,13 +63,13 @@ def copy(self, script_path, target_script):
self.ssh_client.exec_command(f"chmod +x {target_script}")
logger.info("copying script %s to remote - %s - successful", script_path, target_script)

def run_script(self, script_path: str) -> ScriptResult:
def run_script(self, script_path: str, total_runtime_seconds: int = 1200, curve_type: str = 'default') -> ScriptResult:
self.connect()
logger.info("Running script %s ...", script_path)

# ruff: noqa: S108 (Suppressed hard-coded path because we want to intentionally copy stress.sh inside `/tmp` dir)
target_script = "/tmp/stress.sh"
cli_options = f"-t {self.total_runtime_seconds} -c {self.curve_type}"
cli_options = f"-t {total_runtime_seconds} -c {curve_type}"
command = f"{target_script} {cli_options}"
self.copy(script_path, target_script)

Expand Down
3 changes: 0 additions & 3 deletions e2e/tools/validator/validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ config:
mapping:
actual: metal
predicted: vm
stressor:
total_runtime_seconds: 1200
curve_type: default

validations:
- name: node-rapl - kepler-package
Expand Down
4 changes: 4 additions & 0 deletions e2e/tools/validator/validator.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ prometheus:
rate_interval: 20s # Rate interval for Promql, default is 20s, typically 4 x $scrape_interval
steps: 3s # Step duration for Prometheus range queries

stressor:
total_runtime_seconds: 1200
curve_type: default

validations_file: ./validations.yaml # Path to the validations file, default is ./validations.yaml

0 comments on commit f1aa2e5

Please sign in to comment.