Skip to content
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

Feat: add submission scripts and unified histogrammer #103

Merged
merged 5 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 10 additions & 8 deletions condor/execute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ WORKDIR=`pwd`
# Set up mamba environment
## Interactive bash script with fallback pointing to $HOME, hence setting $PWD of worker node as $HOME
export HOME=`pwd`

if ${ARGS[remoteRepo]}!="":
wget -L micro.mamba.pm/install.sh
chmod +x install.sh
## FIXME parsing arguments does not work. will use defaults in install.sh instead, see https://github.com/mamba-org/micromamba-releases/blob/main/install.sh
Expand All @@ -32,7 +34,7 @@ fi

# Get arguments
declare -A ARGS
for key in workflow output samplejson year campaign isSyst isArray noHist overwrite voms chunk skipbadfiles outputXrootdDir remoteRepo; do
for key in workflow output samplejson year campaign isSyst isArray noHist overwrite voms chunk skipbadfiles outputDir remoteRepo; do
ARGS[$key]=$(jq -r ".$key" $WORKDIR/arguments.json)
done

Expand Down Expand Up @@ -86,25 +88,25 @@ echo "Now launching: python runner.py $OPTS"
python runner.py $OPTS

# Transfer output
if [[ ${ARGS[outputXrootdDir]} == root://* ]]; then
if [[ ${ARGS[outputDir]} == root://* ]]; then

xrdcp --silent -p -f -r hists_* ${ARGS[outputXrootdDir]}/
xrdcp --silent -p -f -r hists_* ${ARGS[outputDir]}/
if [[ "$OPTS" == *"isArray"* ]]; then
xrdcp --silent -p -f -r arrays_* ${ARGS[outputXrootdDir]}/
xrdcp --silent -p -f -r arrays_* ${ARGS[outputDir]}/
fi
else
mkdir -p ${ARGS[outputXrootdDir]}
cp -p -f -r hists_* ${ARGS[outputXrootdDir]}/
mkdir -p ${ARGS[outputDir]}
cp -p -f -r hists_* ${ARGS[outputDir]}/
if [[ "$OPTS" == *"isArray"* ]]; then
cp -p -f -r arrays_* ${ARGS[outputXrootdDir]}/
cp -p -f -r arrays_* ${ARGS[outputDir]}/
fi
fi

### one can also consider origanizing the root files in the subdirectory structure ###
# for filename in `\ls *.root`; do
# SAMPLENAME=$(echo "$filename" | sed -E 's/(.*)_f[0-9-]+_[0-9]+\.root/\1/')
# # SAMPLENAME=$(echo "$filename" | sed -E 's/(.*)_[0-9a-z]{9}-[0-9a-z]{4}-.*\.root/\1/')
# xrdcp --silent -p -f $filename ${ARGS[outputXrootdDir]}/$SAMPLENAME/
# xrdcp --silent -p -f $filename ${ARGS[outputDir]}/$SAMPLENAME/
# done

touch $WORKDIR/.success
7 changes: 3 additions & 4 deletions condor/submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def get_condor_submitter_parser(parser):
help="Number of files proceed per condor job",
)
parser.add_argument(
"--outputXrootdDir",
help="Output directory for xrootd files. Start with root://",
"--outputDir",
help="Output directory",
required=True,
)
parser.add_argument(
Expand Down Expand Up @@ -216,7 +216,6 @@ def get_main_parser():
jdl_template = """Universe = vanilla
Executable = {executable}

+ProjectName="cms.org.cern"

Arguments = $(JOBNUM)

Expand Down Expand Up @@ -245,7 +244,7 @@ def get_main_parser():
)
with open(os.path.join(job_dir, "submit.jdl"), "w") as f:
f.write(jdl_template)

os.system(f"condor_submit {job_dir}/submit.jdl")
print(
f"Setup completed. Now submit the condor jobs by:\n condor_submit {job_dir}/submit.jdl"
)
Loading