Skip to content

Commit 2954cfb

Browse files
committed
Fixes after rebasing on top of the PYTHONPATH removal
Signed-off-by: Stefan Marr <[email protected]>
1 parent 098d48b commit 2954cfb

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

rebench/denoise_client.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import getpass
22
import json
3-
import os
43

54
from subprocess import check_output, STDOUT, CalledProcessError
65
from typing import Optional, Tuple
@@ -70,8 +69,12 @@ def system_default() -> "DenoiseInitialSettings":
7069

7170

7271
def _construct_basic_path(env_keys: list[str]) -> list[str]:
73-
assert len(env_keys) > 0
74-
return ["sudo", "--preserve-env=" + ",".join(env_keys), "-n", paths.get_denoise(), "--json"]
72+
if len(env_keys) == 0:
73+
preserve = []
74+
else:
75+
preserve = ["--preserve-env=" + ",".join(env_keys)]
76+
77+
return ["sudo"] + preserve + ["-n", paths.get_denoise(), "--json"]
7578

7679

7780
def _construct_path(for_profiling: bool, env_keys: list[str]) -> list[str]:
@@ -132,9 +135,8 @@ def _add_denoise_exec_options(cmd: list[str], requested: Denoise):
132135

133136

134137
def _exec_denoise(cmd: list[str]):
135-
env = _get_env_with_python_path_for_denoise()
136138
try:
137-
output = output_as_str(check_output(cmd, stderr=STDOUT, env=env))
139+
output = output_as_str(check_output(cmd, stderr=STDOUT))
138140
except CalledProcessError as e:
139141
output = output_as_str(e.output)
140142
except FileNotFoundError as e:
@@ -262,15 +264,12 @@ def minimize_noise(possible_settings: Denoise, for_profiling: bool, show_warning
262264
result, got_json, raw_output, msg, show_warnings, ui, possible_settings)
263265

264266

265-
def construct_denoise_exec_prefix(
266-
env, for_profiling, possible_settings: Denoise) -> Tuple[str, dict]:
267-
env = _add_denoise_python_path_to_env(env)
267+
def construct_denoise_exec_prefix(env, for_profiling, possible_settings: Denoise) -> str:
268268
cmd = _construct_path(for_profiling, env.keys())
269-
270269
_add_denoise_exec_options(cmd, possible_settings)
271270

272271
cmd += ["exec", "--"]
273-
return " ".join(cmd) + " ", env
272+
return " ".join(cmd) + " "
274273

275274
def restore_noise(denoise_result: DenoiseInitialSettings, show_warning, ui):
276275
if denoise_result.nothing_set:

rebench/executor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,11 @@ def _create_scheduler(self, scheduler, print_execution_plan):
357357

358358
def _construct_cmdline_and_env(self, run_id: "RunId", gauge_adapter):
359359
possible_settings = run_id.denoise.possible_settings(self._denoise_initial)
360+
env = run_id.env
360361
if possible_settings.needs_denoise():
361-
cmdline, env = construct_denoise_exec_prefix(
362-
run_id.env, run_id.is_profiling(), possible_settings)
362+
cmdline = construct_denoise_exec_prefix(env, run_id.is_profiling(), possible_settings)
363363
else:
364364
cmdline = ""
365-
env = run_id.env
366365

367366
cmdline += gauge_adapter.acquire_command(run_id)
368367

rebench/model/profiler.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,19 @@ def __lt__(self, other):
8787

8888
return self.report_args < other.report_args
8989

90-
def _construct_report_cmdline_and_env(self, executor, run_id):
90+
def _construct_report_cmdline(self, executor, run_id):
9191
# need to use sudo, otherwise, the profile.perf file won't be accessible
9292
possible_settings = run_id.denoise.possible_settings(executor.get_denoise_initial())
9393
if possible_settings.needs_denoise():
94-
cmd, env = construct_denoise_exec_prefix(run_id.env, True, Denoise.system_default())
94+
cmd = construct_denoise_exec_prefix(run_id.env, True, Denoise.system_default())
9595
else:
96-
env = run_id.env
9796
cmd = ""
9897

99-
return cmd + self.command + " " + self.report_args, env
98+
return cmd + self.command + " " + self.report_args
10099

101100
def process_profile(self, run_id, executor):
102-
cmdline, env = self._construct_report_cmdline_and_env(executor, run_id)
103-
(return_code, output, _) = run(cmdline, env, cwd=run_id.location, shell=True,
101+
cmdline = self._construct_report_cmdline(executor, run_id)
102+
(return_code, output, _) = run(cmdline, run_id.env, cwd=run_id.location, shell=True,
104103
verbose=executor.debug)
105104

106105
if return_code != 0:

0 commit comments

Comments
 (0)