From 6137dca9a6f93f8b00fd269e661e01a432480493 Mon Sep 17 00:00:00 2001 From: Kevin Milner Date: Wed, 18 Oct 2023 13:13:24 -0700 Subject: [PATCH] script updates --- parallel/slurm_sbin/detect_first_running.sh | 3 ++- parallel/slurm_sbin/locate_job_stdout.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/parallel/slurm_sbin/detect_first_running.sh b/parallel/slurm_sbin/detect_first_running.sh index 1c4fa65..d5b6547 100755 --- a/parallel/slurm_sbin/detect_first_running.sh +++ b/parallel/slurm_sbin/detect_first_running.sh @@ -1,3 +1,4 @@ #!/bin/bash -squeue -t R -u $USER -o %A -h | sort | head -n 1 +squeue -t R -u $USER -o "%A %j" -h | grep -v interact | awk '{print $1}' | sort | head -n 1 +#squeue -t R -u $USER -o %A -h | grep -v interact | sort | head -n 1 diff --git a/parallel/slurm_sbin/locate_job_stdout.sh b/parallel/slurm_sbin/locate_job_stdout.sh index 13ed63f..43c83c5 100755 --- a/parallel/slurm_sbin/locate_job_stdout.sh +++ b/parallel/slurm_sbin/locate_job_stdout.sh @@ -14,6 +14,11 @@ else ID=$1 fi +if [[ ! $ID -gt 0 ]];then + echo "Job ID not supplied or not found: $ID" + exit 1 +fi + DIR=`squeue -h -j $ID -o %Z` if [[ ! -e $DIR ]];then @@ -23,6 +28,11 @@ fi OUT=`find $DIR -maxdepth 1 -name "*.o${ID}"` +if [[ ! -e $OUT ]];then + # try another format + OUT=`find $DIR -maxdepth 1 -name "*${ID}.out"` +fi + if [[ ! -e $OUT ]];then echo "Output not found for $ID in $DIR: $OUT" exit 1