-
Notifications
You must be signed in to change notification settings - Fork 29
Avoid starting a Slurm step for every SWE-bench tool call #522
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b65cace
fix: reuse a persistent Pyxis worker for SWE tool commands
leopck 5670742
refactor: make persistent Pyxis the only tool execution path
leopck 9bbb127
refactor: rely on private tempfile directory permissions
leopck 3eafb8b
refactor: package the persistent Pyxis worker as a shell script
leopck ffb7283
refactor: simplify persistent Pyxis command transport
leopck 8e03f57
refactor: keep the persistent root constant in its consuming module
leopck 5666cbe
fix: preserve persistent Pyxis workers through tool cleanup
leopck 6a6fee6
Merge branch 'main' into sphoong/swe-persistent-pyxis
leopck 3680a38
Merge branch 'main' into sphoong/swe-persistent-pyxis
leopck 13c0343
fix: resolve dependency audit and formatting failures
leopck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/inference_endpoint/evaluation/swebench_service/swebench_service/pyxis_command_worker.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -uo pipefail | ||
| root=$1 | ||
| shift | ||
| interpreter=("$@") | ||
| request="$root/running" | ||
| touch "$root/ready" || exit 70 | ||
|
|
||
| while [ ! -e "$root/stop" ]; do | ||
| if [ ! -d "$root/request" ]; then | ||
| sleep 0.05 | ||
| continue | ||
| fi | ||
| # The host serializes callers and removes the previous result before publishing. | ||
| [ ! -e "$request" ] || exit 70 | ||
| mv -- "$root/request" "$request" || exit 70 | ||
| timeout_s=$(cat "$request/timeout") || exit 70 | ||
| case "$timeout_s" in ''|*[!0-9]*|0) exit 70 ;; esac | ||
| # A sentinel preserves trailing newlines in the command and working directory. | ||
| cwd=$(cat "$request/cwd" && printf x) || exit 70 | ||
| # Keep tool text out of supervisor argv so pkill -f cannot match it there. | ||
| unshare --pid --fork --mount-proc \ | ||
| timeout -k 5 "$timeout_s" bash -c ' | ||
| status=$1; cwd=$2; shift 2 | ||
| command=$(cat <&3 && printf x) || exit 70 | ||
| exec 3<&- | ||
| if cd -- "$cwd"; then | ||
| "$@" "${command%x}" | ||
| rc=$? | ||
| else | ||
| rc=125 | ||
| fi | ||
| printf "%s\n" "$rc" > "$status" || exit 70 | ||
| exit "$rc" | ||
| ' command-status "$request/command_status" "${cwd%x}" \ | ||
| "${interpreter[@]}" 3< "$request/command" > "$request/output" 2>&1 | ||
| returncode=$? | ||
| timed_out=0 | ||
| # Explicit exits 124/137 are command results, not timeout notifications. | ||
| if [ "$(cat "$request/command_status" 2>/dev/null)" != "$returncode" ]; then | ||
| case "$returncode" in 124|137) timed_out=1 ;; *) exit 70 ;; esac | ||
| fi | ||
| size=$(wc -c < "$request/output") || exit 70 | ||
| printf '%s %s %s\n' "$returncode" "$timed_out" "$((size))" > "$request/complete.tmp" || exit 70 | ||
| mv -- "$request/complete.tmp" "$request/complete" || exit 70 | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.