-
Notifications
You must be signed in to change notification settings - Fork 0
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
#DRAFT/WIP 20 allow custom submissions to slurm #21
base: main
Are you sure you want to change the base?
Changes from all commits
433eab4
63c7697
c27c221
3bdc1f2
f7729ef
522f3cf
f6693e2
84f708a
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 |
---|---|---|
|
@@ -28,12 +28,32 @@ shift | |
TARGET=${1:-2} | ||
shift | ||
|
||
# environment variable to indicate whether the job is running on condor or slurm | ||
SYSTEM=${SYSTEM:-condor} | ||
|
||
# process csv file into jobs | ||
CSV_FILE=$($(dirname $0)/csv_to_chunks.sh ${FILE} ${TARGET}) | ||
if [ -n "${CSV_FILE:-}" ]; then | ||
# allow to set custom csv file for job instead of fetching from web archive | ||
CSV_FILE=$(realpath -e ${CSV_FILE}) | ||
else | ||
CSV_FILE=$($(dirname $0)/csv_to_chunks.sh ${FILE} ${TARGET}) | ||
fi | ||
|
||
# create command line | ||
EXECUTABLE="./scripts/run.sh" | ||
ARGUMENTS="${TYPE} EVGEN/\$(file).\$(ext) \$(nevents) \$(ichunk)" | ||
EXECUTABLE="$PWD/scripts/run.sh" | ||
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. Probably should use something that determines the directory of the current script, e.g. |
||
if [ ${SYSTEM} = "condor" ]; then | ||
ARGUMENTS="${TYPE} EVGEN/\$(file).\$(ext) \$(nevents) \$(ichunk)" | ||
elif [ ${SYSTEM} = "slurm" ]; then | ||
Comment on lines
+44
to
+46
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. if elif else fi can be turned into case statement |
||
ARGUMENTS="${TYPE}" | ||
# FIXME: This is not ideal. It prevents from submitting multiple jobs with different JUG_XL_TAG simultaneously. | ||
cd scripts | ||
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. See above for Also pushd-popd for directory stacks then. |
||
wget --output-document install.sh https://get.epic-eic.org | ||
sed -i 's/nightly/${JUG_XL_TAG}/g' install.sh | ||
bash install.sh | ||
cd .. | ||
else | ||
echo "Enter a valid SYSTEM value (condor or slurm)" | ||
fi | ||
|
||
# construct environment file | ||
ENVIRONMENT=environment-$(date --iso-8601=minutes).sh | ||
|
@@ -54,8 +74,12 @@ REQUIREMENTS="" | |
# construct input files | ||
INPUT_FILES=${ENVIRONMENT} | ||
|
||
# calculate number of jobs being submitted | ||
NJOBS=$( wc -l ${CSV_FILE} | awk '{print $1}' ) | ||
|
||
# construct submission file | ||
SUBMIT_FILE=$(basename ${CSV_FILE} .csv).submit | ||
|
||
sed " | ||
s|%EXECUTABLE%|${EXECUTABLE}|g; | ||
s|%ARGUMENTS%|${ARGUMENTS}|g; | ||
|
@@ -65,14 +89,34 @@ sed " | |
s|%INPUT_FILES%|${INPUT_FILES}|g; | ||
s|%REQUIREMENTS%|${REQUIREMENTS}|g; | ||
s|%CSV_FILE%|${CSV_FILE}|g; | ||
s|%ACCOUNT%|${ACCOUNT:?Define ACCOUNT with the slurm account}|g; | ||
s|%CAMPAIGN_LOG%|${CAMPAIGN_LOG:-$PWD}|g; | ||
s|%TARGET%|$TARGET|g; | ||
s|%NJOBS%|${NJOBS}|g; | ||
" templates/${TEMPLATE}.submit.in > ${SUBMIT_FILE} | ||
|
||
# submit job | ||
condor_submit -verbose -file ${SUBMIT_FILE} | ||
|
||
# create log dir | ||
if [ $? -eq 0 ] ; then | ||
for i in `condor_q | grep ^${USER} | tail -n1 | awk '{print($NF)}' | cut -d. -f1` ; do | ||
mkdir -p LOG/CONDOR/osg_$i/ | ||
done | ||
echo "Submitting ${NJOBS} to a ${SYSTEM} system" | ||
|
||
if [ ${SYSTEM} = "condor" ]; then | ||
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. case. |
||
condor_submit -verbose -file ${SUBMIT_FILE} | ||
|
||
# create log dir | ||
if [ $? -eq 0 ] ; then | ||
for i in `condor_q | grep ^${USER} | tail -n1 | awk '{print($NF)}' | cut -d. -f1` ; do | ||
mkdir -p ${CAMPAIGN_LOG:-$PWD}/LOG/CONDOR/osg_$i/ | ||
done | ||
fi | ||
elif [ ${SYSTEM} = "slurm" ]; then | ||
sbatch ${SUBMIT_FILE} | ||
|
||
# create log dir | ||
if [ $? -eq 0 ] ; then | ||
for i in `squeue -u ${USER} | tail -n1 | awk '{$1=$1; print}' | awk -F" |_" '{print($1)}' | cut -d. -f1` ; do | ||
mkdir -p ${CAMPAIGN_LOG:-$PWD}/LOG/SLURM/slurm_$i/ | ||
done | ||
fi | ||
else | ||
echo "Enter a valid SYSTEM value (condor or slurm)" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export S3_ACCESS_KEY=%S3_ACCESS_KEY% | ||
export S3_SECRET_KEY=%S3_SECRET_KEY% | ||
export S3RW_ACCESS_KEY=%S3RW_ACCESS_KEY% | ||
export S3RW_SECRET_KEY=%S3RW_SECRET_KEY% | ||
export DETECTOR_VERSION=%DETECTOR_VERSION% | ||
export DETECTOR_CONFIG=%DETECTOR_CONFIG% | ||
export EBEAM=%EBEAM% | ||
export PBEAM=%PBEAM% |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
#SBATCH --account=%ACCOUNT% | ||
#SBATCH --array=1-%NJOBS% | ||
#SBATCH --ntasks=1 # number of MPI processes | ||
#SBATCH --mem-per-cpu=3G # memory; default unit is megabytes | ||
#SBATCH --time=0-%TARGET%:00 # time (DD-HH:MM) | ||
#SBATCH --output=%CAMPAIGN_LOG%/LOG/SLURM/slurm_%A/slurm_%A_%a.out # standard output log | ||
#SBATCH --error=%CAMPAIGN_LOG%/LOG/SLURM/slurm_%A/slurm_%A_%a.err # standard error log | ||
|
||
input_string=$(sed "${SLURM_ARRAY_TASK_ID}q;d" %CSV_FILE%) | ||
read -r file ext nevents ichunk <<< $(echo "$input_string" | awk -F',' '{print $1, $2, $3, $4}') | ||
|
||
echo $file | ||
echo $ext | ||
echo $nevents | ||
echo $ichunk | ||
|
||
cat << EOF | $(dirname %EXECUTABLE%)/eic-shell | ||
|
||
%EXECUTABLE% %ARGUMENTS% EVGEN/${file}.${ext} ${nevents} ${ichunk} | ||
|
||
EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SYSTEM
may be a bit generic. How aboutSCHEDULER
or something like that?