Crombie Tools
run.sh
Go to the documentation of this file.
1 #! /bin/bash
2 
3 hostname
4 pwd
5 
6 ID=$1
7 
8 wget -O params.json http://t3serv001.mit.edu/~dabercro/squid/\?id=$ID
9 
10 # Bootstrap jq out of our tarball
11 
12 tar -xf condor.tgz bin/*/jq --strip=2
13 
14 # Get the parameters from the json file
15 
16 ./jq . params.json
17 
18 EXE=$(./jq -r '.exe' params.json)
19 INPUT_DIR=$(./jq -r '.input_dir' params.json)
20 INPUT_FILES=$(./jq -r '.input_files | join(" ")' params.json)
21 OUTPUT_FILE=$(./jq -r '.output_file' params.json)
22 SCRAM_ARCH=$(./jq -r '.arch' params.json)
23 CMSSW_VERSION=$(./jq -r '.cmssw' params.json)
24 BASE=$(./jq -r '.base' params.json)
25 
26 # Setup CMSSW
27 
28 source /cvmfs/cms.cern.ch/cmsset_default.sh
29 
30 test -d $CMSSW_VERSION || scram project CMSSW $CMSSW_VERSION
31 pushd $CMSSW_VERSION
32 tar -xf ../condor.tgz
33 cd src
34 
35 eval `scram runtime -sh`
36 
37 popd
38 
39 if [ -d $CMSSW_BASE/data ]
40 then
41  ln -s $CMSSW_BASE/data data
42 fi
43 
44 echo ""
45 echo "After CMSSW setup"
46 echo ""
47 pwd
48 ls -lh
49 
50 # Download or softlink Panda files
51 
52 SCRATCH=/mnt/hadoop/scratch/dabercro
53 NEW_INPUT_DIR=$SCRATCH$INPUT_DIR
54 
55 for IN_FILE in $INPUT_FILES
56 do
57 
58  if [ ! -f $IN_FILE ]
59  then
60 
61  # Check to see if it exists locally in the normal place
62 
63  FULL_IN=/mnt/hadoop/cms$INPUT_DIR/$IN_FILE
64 
65  if [ -f $FULL_IN ]
66  then
67 
68  cp -v $FULL_IN $IN_FILE
69 
70  else
71 
72  xrdcp root://xrootd.cmsaf.mit.edu//$INPUT_DIR/$IN_FILE .
73 
74  fi
75 
76  fi
77 
78 done
79 
80 echo ""
81 echo "After download"
82 echo ""
83 
84 pwd
85 ls -lh
86 
87 # Run the slimmer
88 
89 test -f $OUTPUT_FILE || $EXE $INPUT_FILES $OUTPUT_FILE
90 
91 exitcode=$?
92 
93 echo ""
94 echo "After slimmer"
95 echo ""
96 
97 pwd
98 ls -lh
99 
100 # The condor.cfg maps the output file to the correct place
101 
102 # Give the exit code from the slimmer
103 echo "Exiting with $exitcode"
104 exit $exitcode