-
Notifications
You must be signed in to change notification settings - Fork 132
Shell completion auto-install and pre-commit hook improvements #1124
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
Changes from all commits
7496ab7
26f7e17
4b17fa2
1b211a5
9304137
77ac8cc
a7cf1d2
4b55c30
e017cf0
780138b
06f0425
f65ed30
d23addc
33cbd0e
1ba4666
adfcb7f
02ef3de
ff8d499
fc5e2a5
9c15c8a
52d0ddd
8e3f405
989a79d
e913f7c
6972e6e
cf49bcc
72d8a38
88d8736
c96edf2
b44360f
f24c62b
e0bdc88
f9fa919
0ec406b
1e863ae
73e0de3
b76f0a3
13fcc83
6b0faef
2651c08
18548ab
32c4fa4
cd1b771
4353e1e
40a12e1
0fdd27e
8321eac
f213175
3470c7a
d169d08
9734b2d
3fefb70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |||||
|
|
||||||
| set -e | ||||||
|
|
||||||
| # Ignore SIGHUP to survive login node session drops | ||||||
| trap '' HUP | ||||||
|
|
||||||
| usage() { | ||||||
| echo "Usage: $0 [script.sh] [cpu|gpu]" | ||||||
| } | ||||||
|
|
@@ -26,17 +29,17 @@ fi | |||||
|
|
||||||
|
|
||||||
| job_slug="`basename "$1" | sed 's/\.sh$//' | sed 's/[^a-zA-Z0-9]/-/g'`-$2-$3" | ||||||
| output_file="$job_slug.out" | ||||||
|
|
||||||
| sbatch <<EOT | ||||||
| submit_output=$(sbatch <<EOT | ||||||
| #!/bin/bash | ||||||
| #SBATCH -J MFC-$job_slug # Job name | ||||||
| #SBATCH -A CFD154 # charge account | ||||||
| #SBATCH -A ENG160 # charge account | ||||||
| #SBATCH -N 1 # Number of nodes required | ||||||
| $sbatch_device_opts | ||||||
| #SBATCH -t 05:59:00 # Duration of the job (Ex: 15 mins) | ||||||
| #SBATCH -o$job_slug.out # Combined output and error messages file | ||||||
| #SBATCH -o$output_file # Combined output and error messages file | ||||||
| #SBATCH -p extended # Extended partition for shorter queues | ||||||
| #SBATCH -W # Do not exit until the submitted job terminates. | ||||||
| set -e | ||||||
| set -x | ||||||
|
|
@@ -53,4 +56,17 @@ job_interface="$3" | |||||
| $sbatch_script_contents | ||||||
| EOT | ||||||
| ) | ||||||
|
|
||||||
| job_id=$(echo "$submit_output" | grep -oE '[0-9]+') | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The job ID extraction uses Severity Level: Major
|
||||||
| job_id=$(echo "$submit_output" | grep -oE '[0-9]+') | |
| job_id=$(echo "$submit_output" | grep -oE '[0-9]+' | head -n1) |
Steps of Reproduction ✅
1. In the repo root, create a SLURM batch script `array_job.sh` that defines an array job,
e.g.:
- `#SBATCH --array=0-3`
This script will later be passed as `$1` to `.github/workflows/frontier/submit.sh`.
2. On a SLURM system, run the wrapper:
- `.github/workflows/frontier/submit.sh array_job.sh cpu`
This executes the logic in `.github/workflows/frontier/submit.sh` including the
`sbatch` submission block and captures `sbatch` output into `submit_output`.
3. SLURM prints a message like `Submitted batch job 123456_0` (typical for array jobs) to
stdout. The script at `.github/workflows/frontier/submit.sh:31-58` captures this into
`submit_output`, then the block at lines 61-66 executes:
- `job_id=$(echo "$submit_output" | grep -oE '[0-9]+')`
`grep -oE '[0-9]+'` returns two lines: `123456` and `0`, so `job_id` contains a
newline-separated list of two numeric tokens.
4. The monitoring code at `.github/workflows/frontier/submit.sh:71-72` runs:
- `bash "$SCRIPT_DIR/../../scripts/monitor_slurm_job.sh" "$job_id" "$output_file"`
Because `"$job_id"` contains a newline, `monitor_slurm_job.sh` receives an invalid job
identifier (either as a value with embedded newline or as multiple numeric tokens,
depending on its parsing). This causes incorrect monitoring behavior for the submitted
job array (e.g., failing SLURM commands like `squeue -j` or tracking the wrong job),
demonstrating that extracting all numeric substrings from `submit_output` produces an
invalid job ID when multiple numbers are present.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** .github/workflows/frontier/submit.sh
**Line:** 61:61
**Comment:**
*Logic Error: The job ID extraction uses `grep -oE '[0-9]+'` directly on the `sbatch` output, which returns every numeric substring on separate lines; if the output ever contains more than one number, `job_id` will contain multiple IDs separated by newlines, causing the monitoring script to receive an invalid job identifier and fail to track the job correctly. Limiting the extraction to the first numeric match avoids this and ensures `job_id` is a single valid token.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Uh oh!
There was an error while loading. Please reload this page.