Skip to content
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
23 changes: 19 additions & 4 deletions scripts/run_performance_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ def get_pre_commands(
]

# Clear the PYTHONPATH first so that modules installed elsewhere are not used
# Note: On Windows, 'set PYTHONPATH=' must be a separate command, not chained with &&,
# otherwise Python fails with "OSError: failed to make path absolute"
if os_group == "windows":
install_prerequisites += ["set PYTHONPATH="]
helix_pre_commands += ["set PYTHONPATH="]
else:
install_prerequisites += ["export PYTHONPATH="]

Expand Down Expand Up @@ -207,8 +209,15 @@ def get_pre_commands(

# Add the install_prerequisites to the pre_commands
if os_group == "windows":
# TODO: Should we also give Windows the same treatment as linux and ensure that each command succeeds?
helix_pre_commands += install_prerequisites
# Chain Windows commands with error checking using && to ensure each command succeeds
# If any command fails, set PERF_PREREQS_INSTALL_FAILED and report the error
if install_prerequisites:
combined_prerequisites = " && ".join(install_prerequisites)
helix_pre_commands += [
'echo ** Installing prerequisites **',
f'{combined_prerequisites} || set PERF_PREREQS_INSTALL_FAILED=1',
'if defined PERF_PREREQS_INSTALL_FAILED (echo ** Error: Failed to install prerequisites ** && exit /b 1)'
]
else:
if install_prerequisites:
combined_prequisites = " && ".join(install_prerequisites)
Expand Down Expand Up @@ -272,7 +281,13 @@ def get_post_commands(os_group: str, internal: bool, runtime_type: str):
helix_post_commands = ["export PYTHONPATH=$ORIGPYPATH"]

if internal:
helix_post_commands += ["deactivate"] # deactivate venv
if os_group == "windows":
# Must use 'call' to invoke deactivate.bat, otherwise the batch file
# transfers control to deactivate.bat and never returns, causing the
# EXIT /b %_commandExitCode% at the end of the Helix work item to never run
helix_post_commands += ["call deactivate"]
else:
helix_post_commands += ["deactivate"] # deactivate venv

if runtime_type == "wasm" and os_group != "windows":
helix_post_commands += [
Expand Down
Loading