Skip to content

Commit

Permalink
Improve on the query script
Browse files Browse the repository at this point in the history
  • Loading branch information
linsword13 committed Dec 11, 2024
1 parent a415baa commit 85f1487
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

_ensure_job_id_snippet = r"""
job_id=$(< {experiment_run_dir}/.slurm_job)
if [ -z "${job_id:-}"]; then
if [ -z "${job_id:-}" ]; then
echo "No valid job_id found" 1>&2
exit 1
fi
Expand Down Expand Up @@ -133,7 +133,13 @@ def __init__(self, dry_run=False):
)

def generate_query_command(self, job_id):
return f"squeue -j {job_id}"
return rf"""
status=$(squeue -h -o "%t" -j {job_id})
if [ -z "$status" ]; then
status=$(sacct -j {job_id} -o state -X -n)
fi
echo $status
"""

def generate_cancel_command(self, job_id):
return f"scancel {job_id}"
Expand Down

0 comments on commit 85f1487

Please sign in to comment.