Skip to content

Commit cc3e8aa

Browse files
authored
Update benchmark script to always copy env vars (#1394)
This commit changes the way environment variables are populated when running the benchmark script. There's no reason for us not to copy environment variables from the script into the launched subprocesses, and adding the functionality allows us to manipulate settings like the logging level without making changes to `benchmark/benchmark.py`. ### Does this change impact existing behavior? This change updates the way when using benchmark scripts, FIO and Mountpoint are launched in `benchmark/` to copy over the existing environment. ### Does this change need a changelog entry? Does it require a version change? No, benchmark change only. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the [Developer Certificate of Origin (DCO)](https://developercertificate.org/). Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
1 parent dac707f commit cc3e8aa

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

benchmark/benchmark.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ def _mount_mp(
9191
"--allow-delete",
9292
f"--log-directory={MP_LOGS_DIRECTORY}",
9393
]
94-
subprocess_env = {
95-
"PATH": os.environ["PATH"],
96-
}
94+
subprocess_env = os.environ.copy()
9795

9896
if cfg['s3_prefix'] is not None:
9997
subprocess_args.append(f"--prefix={cfg['s3_prefix']}")
@@ -174,14 +172,12 @@ def _run_fio(cfg: DictConfig, mount_dir: str) -> None:
174172
f"--directory={mount_dir}",
175173
fio_job_filepath,
176174
]
177-
subprocess_env = {
178-
"PATH": os.environ["PATH"],
179-
"APP_WORKERS": str(cfg['application_workers']),
180-
"SIZE_GIB": "100",
181-
"DIRECT": "1" if cfg['direct_io'] else "0",
182-
"UNIQUE_DIR": datetime.now(tz=timezone.utc).isoformat(),
183-
"IO_ENGINE": cfg['fio_io_engine'],
184-
}
175+
subprocess_env = os.environ.copy()
176+
subprocess_env["APP_WORKERS"] = str(cfg['application_workers'])
177+
subprocess_env["SIZE_GIB"] = "100"
178+
subprocess_env["DIRECT"] = "1" if cfg['direct_io'] else "0"
179+
subprocess_env["UNIQUE_DIR"] = datetime.now(tz=timezone.utc).isoformat()
180+
subprocess_env["IO_ENGINE"] = cfg['fio_io_engine']
185181
log.info("Running FIO with args: %s; env: %s", subprocess_args, subprocess_env)
186182

187183
# Use Popen instead of check_output, as we had some issues when trying to attach perf

0 commit comments

Comments
 (0)