Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion scripts/slurm_checkjob
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Wraper script for slurm job check
# Args are the Job ID
# Returns back Running, Finished, Pending or Unknown
#
# Ensure that slurm_submit and slurm_checkjob are in the PATH . ~/.local_settings may need to be updated
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra space after the # character - should be '# Ensure' instead of '# Ensure' for consistency with other comments.

Suggested change
# Ensure that slurm_submit and slurm_checkjob are in the PATH . ~/.local_settings may need to be updated
# Ensure that slurm_submit and slurm_checkjob are in the PATH . ~/.local_settings may need to be updated

Copilot uses AI. Check for mistakes.

JS=$(squeue -j $1 -o %t --noheader)

if [ -z "$JS" ] ; then
Expand Down
6 changes: 5 additions & 1 deletion scripts/slurm_submit
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
# Wrapper script for Slurm batch submit
# Args are submit script, outputfile, and error file
# Return the job id via stdout
# Ensure that slurm_submit and slurm_checkjob are in the PATH . ~/.local_settings may need to be updated
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra space in 'that slurm_submit' - should be 'that slurm_submit' with only one space.

Suggested change
# Ensure that slurm_submit and slurm_checkjob are in the PATH . ~/.local_settings may need to be updated
# Ensure that slurm_submit and slurm_checkjob are in the PATH . ~/.local_settings may need to be updated

Copilot uses AI. Check for mistakes.


module purge
PATH=/usr/common/software/bin:/usr/common/mss/bin:/usr/common/nsg/bin:/opt/ovis/bin:/opt/ovis/sbin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally don't think paths should be hardcoded in scripts, but it seems unlikely this script is ever going to be used for anything other than hipmer so it's probably fine


SUBMIT=$1
LOGFILE=$2
ERRFILE=$3

sbatch -o $LOGFILE -e $ERRFILE $SUBMIT
sbatch -o $LOGFILE -e $ERRFILE $SUBMIT|sed 's/Submitted batch job //'
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command assumes sbatch will always output 'Submitted batch job ' prefix. Consider adding error handling to verify the command succeeded and the output format is as expected before parsing.

Suggested change
sbatch -o $LOGFILE -e $ERRFILE $SUBMIT|sed 's/Submitted batch job //'
# Submit the job and capture output
SBATCH_OUTPUT=$(sbatch -o "$LOGFILE" -e "$ERRFILE" "$SUBMIT")
SBATCH_EXIT=$?
# Check if sbatch succeeded
if [ $SBATCH_EXIT -ne 0 ]; then
echo "Error: sbatch failed with exit code $SBATCH_EXIT" >&2
echo "$SBATCH_OUTPUT" >&2
exit $SBATCH_EXIT
fi
# Extract job ID from output
if [[ "$SBATCH_OUTPUT" =~ ^Submitted\ batch\ job\ ([0-9]+) ]]; then
echo "${BASH_REMATCH[1]}"
else
echo "Error: Unexpected sbatch output format:" >&2
echo "$SBATCH_OUTPUT" >&2
exit 1
fi

Copilot uses AI. Check for mistakes.

Loading