-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from desihub/fuji-guadalupe
Updates for fuji and guadalupe
- Loading branch information
Showing
4 changed files
with
172 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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,30 @@ | ||
#!/bin/bash | ||
if [[ $# < 1 ]]; then | ||
echo "SPECPROD is required!" | ||
exit 1 | ||
fi | ||
if [[ $# < 2 ]]; then | ||
echo "DIRECTORY is required!" | ||
exit 1 | ||
fi | ||
export SPECPROD=$1 | ||
directory=$2 | ||
[[ -z "${DESI_SPECTRO_REDUX}" ]] && export DESI_SPECTRO_REDUX=/global/cfs/cdirs/desi/spectro/redux | ||
for d in ${DESI_SPECTRO_REDUX}/${SPECPROD}/${directory}/*; do | ||
n=$(basename ${d}) | ||
job_name=redux_${SPECPROD}_$(tr '/' '_' <<<${directory})_${n} | ||
cat > ${job_name}.sh <<EOT | ||
#!/bin/bash | ||
#SBATCH --account=desi | ||
#SBATCH --qos=xfer | ||
#SBATCH --time=12:00:00 | ||
#SBATCH --mem=10GB | ||
#SBATCH --job-name=${job_name} | ||
#SBATCH --licenses=cfs | ||
cd ${DESI_SPECTRO_REDUX}/${SPECPROD}/${directory} | ||
hsi mkdir -p desi/spectro/redux/${SPECPROD}/${directory} | ||
htar -cvf desi/spectro/redux/${SPECPROD}/${directory}/${job_name}.tar -H crc:verify=all ${n} | ||
[[ \$? == 0 ]] && mv -v /global/homes/d/desi/jobs/${job_name}.sh /global/homes/d/desi/jobs/done | ||
EOT | ||
chmod +x ${job_name}.sh | ||
done |
This file contains 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,71 @@ | ||
#!/bin/bash | ||
# | ||
module load esslurm | ||
function usage() { | ||
local execName=$(basename $0) | ||
( | ||
echo "${execName} [-h] [-j JOBS] [-m JOBS] [-s SECONDS] [-t] [-v] PREFIX" | ||
echo "" | ||
echo "Submit jobs that match PREFIX." | ||
echo "" | ||
echo " -h = Print this message and exit." | ||
echo " -j JOBS = Fill the queue up to JOBS jobs (default 12)." | ||
echo " -m JOBS = Submit no more that JOBS jobs total (default is all matching jobs)." | ||
echo " -s SECONDS = Sleep between submission batches (default 60)." | ||
echo " -t = Test mode. Do not actually make any changes. Implies -v." | ||
echo " -v = Verbose mode. Print extra information." | ||
# echo " -V = Version. Print a version string and exit." | ||
) >&2 | ||
} | ||
max_jobs=12 | ||
total_jobs='' | ||
sleepy_time=60 | ||
verbose=false | ||
test=false | ||
while getopts hj:m:s:tv argname; do | ||
case ${argname} in | ||
h) usage; exit 0 ;; | ||
j) max_jobs=${OPTARG} ;; | ||
m) total_jobs=${OPTARG} ;; | ||
s) sleepy_time=${OPTARG} ;; | ||
t) test=true; verbose=true ;; | ||
v) verbose=true ;; | ||
*) usage; exit 1 ;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
if (( $# < 1 )); then | ||
echo "ERROR: PREFIX required!" | ||
exit 1 | ||
fi | ||
prefix=$1 | ||
available_jobs=($(ls ${prefix}*)) | ||
if [[ -n "${total_jobs}" ]]; then | ||
n_available=${total_jobs} | ||
else | ||
n_available=${#available_jobs[*]} | ||
fi | ||
j=0 | ||
while true; do | ||
echo -n "INFO: " | ||
date | ||
foo=$(squeue -u ${USER} | wc -l) | ||
n_jobs=$(( foo - 1 )) | ||
if (( n_jobs < max_jobs )); then | ||
n_submitted=0 | ||
while (( j < n_available && n_submitted + n_jobs < max_jobs )); do | ||
${verbose} && echo "DEBUG: sbatch ${available_jobs[${j}]}" | ||
${test} || sbatch ${available_jobs[${j}]} | ||
n_submitted=$(( n_submitted + 1 )) | ||
j=$(( j + 1 )) | ||
done | ||
echo "INFO: Submitted ${n_submitted} jobs." | ||
${verbose} && echo "DEBUG: Job index is ${j}." | ||
fi | ||
if (( j == n_available)); then | ||
echo "INFO: All jobs submitted." | ||
break | ||
fi | ||
${verbose} && echo "DEBUG: sleep ${sleepy_time}" | ||
sleep ${sleepy_time} | ||
done |
This file contains 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