Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport perf-v16] fix(stress_thread): stop assuming current path #9567

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions sdcm/stress_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ def validate_and_collect_hdr_file(self):
if not result.ok:
HDRFileMissed(message=f"'{self._remote_log_file}' HDR file was not created on the loader {self._node.name}",
severity=Severity.ERROR).publish()

LOGGER.debug("The '%s' file found on the loader %s", self._remote_log_file, self._node.name)
self._node.remoter.receive_files(src=self._remote_log_file, dst=self._target_log_file)
try:
LOGGER.debug("The '%s' file found on the loader %s", self._remote_log_file, self._node.name)
self._node.remoter.receive_files(src=self._remote_log_file, dst=self._target_log_file)
except Exception: # noqa: BLE001
HDRFileMissed(message=f"'{self._remote_log_file}' HDR file couldn't copied from loader {self._node.name}",
severity=Severity.ERROR).publish()

def __enter__(self):
self.start()
Expand Down Expand Up @@ -287,14 +290,17 @@ def _run_cs_stress(self, loader, loader_idx, cpu_idx, keyspace_idx): # pylint:
local_hdr_file_name = os.path.join(loader.logdir, remote_hdr_file_name)
LOGGER.debug("cassandra-stress HDR local file %s", local_hdr_file_name)

remote_hdr_file_name_full_path = remote_hdr_file_name
if "k8s" in self.params.get("cluster_backend"):
cmd_runner = loader.remoter
cmd_runner_name = loader.remoter.pod_name
elif self.params.get("use_prepared_loaders"):
cmd_runner = loader.remoter
cmd_runner_name = loader.ip_address
else:
loader.remoter.run(f"touch $HOME/{remote_hdr_file_name}", ignore_status=True, verbose=False)
loader.remoter.run(f"touch $HOME/{remote_hdr_file_name}", ignore_status=False, verbose=False)
remote_hdr_file_name_full_path = loader.remoter.run(
f"realpath $HOME/{remote_hdr_file_name}", ignore_status=False, verbose=False).stdout.strip()
cmd_runner_name = loader.ip_address

cpu_options = ""
Expand All @@ -306,7 +312,7 @@ def _run_cs_stress(self, loader, loader_idx, cpu_idx, keyspace_idx): # pylint:
f'--label shell_marker={self.shell_marker}'
f' --entrypoint /bin/bash'
f' -w /'
f' -v $HOME/{remote_hdr_file_name}:/{remote_hdr_file_name}')
f' -v {remote_hdr_file_name_full_path}:/{remote_hdr_file_name}')

stress_cmd = self.create_stress_cmd(cmd_runner, keyspace_idx, loader)
if self.params.get('cs_debug'):
Expand Down Expand Up @@ -337,7 +343,7 @@ def _run_cs_stress(self, loader, loader_idx, cpu_idx, keyspace_idx): # pylint:
stress_cmd = self._add_hdr_log_option(stress_cmd, remote_hdr_file_name)
hdr_logger_context = CSHDRFileLogger(
node=loader,
remote_log_file=remote_hdr_file_name,
remote_log_file=remote_hdr_file_name_full_path,
target_log_file=os.path.join(loader.logdir, remote_hdr_file_name),
)
else:
Expand Down
Loading