-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneric.jobscript
106 lines (85 loc) · 2.78 KB
/
generic.jobscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
:<<'EOF'
Use this jobscript with justIN to create ntuples from files:
justin quick-request \
--mql "YOUR_MQL_EXPRESSION" \
--jobscript ntuple.jobscript --max-distance 100 --rss-mb 4000 \
--scope usertests \
--output-pattern 'duneana_ntuple.*.root:output-test-01' \
--output-pattern 'duneana_ntuple.*.log:output-test-01'
The root ntuple file and the lar log file is put into Rucio managed storage
AT THE MOMENT, NO METADATA IS GENERATED BY THIS JOBSCRIPT AND ONLY THE DEFAULT
JOB METADATA CREATED BY justIN WILL BE PUT INTO MetaCat FOR THESE FILES!
The following optional environment variables can be set when creating the
workflow/stage: FCLFILE, NEVENTS, OUTPREFIX, DUNE_VERSION, DUNE_QUALIFIER
For example, add this line to the justin quick-request command to limit the
processing to 10 events per file:
--env NEVENTS=10
EOF
echo "Will setup"
#Setup general dune software
source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh
#Setup recent lar software suite
setup dunesw \
"${DUNE_VERSION:-v09_79_00d00}" \
-q "${DUNE_QUALIFIER:-e26:prof}"
echo "Will use justin-get-file"
touch filelist.txt
touch didlist.txt
for i in `seq 1 ${NFILES:-1}`; do
echo $i
FULLFILE=`$JUSTIN_PATH/justin-get-file`
#THISFILE=`$JUSTIN_PATH/justin-get-file | cut -f2 -d' '`
THISPFN=`echo $FULLFILE | cut -f2 -d' '`
THISDID=`echo $FULLFILE | cut -f2 -d' '`
echo $THISPFN
echo $THISPFN >> filelist.txt
echo $THISDID
echo $THISDID >> didlist.txt
done
#FILE=`$JUSTIN_PATH/justin-get-file | cut -f2 -d' '`
now=$(date -u +"%Y-%m-%dT_%H%M%SZ")
OUTFILE="${OUTPREFIX:-duneana_ntuple}.${JUSTIN_REQUEST_ID}"
OUTFILE="$OUTFILE.$JUSTIN_JOBSUB_ID.${now}"
OUTFILE=`echo $OUTFILE | sed -e 's/@/./'`
if [ -z $NTUPLE ]; then
echo "asdf"
OUTFLAG="-o"
else
echo "ntuple"
OUTFLAG="-T"
fi
#echo "Running on $FILE"
if [ -z $HDF5JOB ]; then
lar -c "${FCLFILE:-pduneana_Prod4a_MC_sce.fcl}" \
"$OUTFLAG" "$OUTFILE.root" \
-n "${NEVENTS:--1}" \
-S filelist.txt >$OUTFILE.log 2>&1
#"$FILE" >$OUTFILE.log 2>&1
else
(
export LD_PRELOAD=${XROOTD_LIB}/libXrdPosixPreload.so
lar -c "${FCLFILE:-pduneana_Prod4a_MC_sce.fcl}" \
"$OUTFLAG" "$OUTFILE.root" \
-n "${NEVENTS:--1}" \
-S filelist.txt >$OUTFILE.log 2>&1
#"$FILE" >$OUTFILE.log 2>&1
)
fi
larExit=$?
echo "lar exit code $larExit"
if [ $larExit -eq 0 ] ; then
# Success !
#echo "$FILE" > justin-processed-pfns.txt
cat filelist.txt > justin-processed-pfns.txt
jobscriptExit=0
else
# Oh :(
jobscriptExit=1
fi
#echo "EXTRACTING METADATA"
#python $INPUT_TAR_DIR_LOCAL/extract_metadata.py --files `cat didlist.txt` -o "$OUTFILE.root.json" --tier raw
#cat "$OUTFILE.root.json"
# Put last 100 lines of lar log into the HTCondor and Jobscript logs
tail -100 $OUTFILE.log
exit $jobscriptExit