-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New script submit_condor.py writes a condor config and optionally submits it to the queue. The runDat2Root script should be used to run dat2root in a condor job. The condor job must be able to access the submission directory. On LPC, submit from /uscms_data/, because condor cannot access your home directory.
- Loading branch information
Dustin
committed
May 6, 2017
1 parent
be366c5
commit 4d08c2d
Showing
4 changed files
with
97 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
*.o | ||
*.root | ||
*.dat | ||
*.swp | ||
*.log.* | ||
*.out.* | ||
*.err.* | ||
*.cmd | ||
dat2root |
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 @@ | ||
Condor configs and log files go here. |
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,17 @@ | ||
#!/bin/sh | ||
|
||
### Wrapper around dat2root script: picks up environment from local CMSSW area, then runs dat2root | ||
# Arguments: | ||
# 1) path to directory containing dat2root (should be inside a CMSSW release area) | ||
# 2) input file name | ||
# 3) name of output file | ||
# 4) path to config file | ||
|
||
source /cvmfs/cms.cern.ch/cmsset_default.sh | ||
cd $1; eval `scramv1 runtime -sh`; cd - | ||
cp $1/dat2root . | ||
|
||
# specify 100000 events to ensure we run over the whole input file | ||
cmd="./dat2root $2 $3 100000 --config=$4" | ||
echo $cmd | ||
eval $cmd |
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,73 @@ | ||
### Script to submit dat2root jobs using condor | ||
### Author: Dustin Anderson | ||
|
||
import os | ||
import sys | ||
import argparse | ||
|
||
def submitCondorJob(executable, options, infile, outfile, | ||
submit=False, proxy="/tmp/x509up_u31156"): | ||
base = os.path.basename(outfile).replace('.root','') | ||
subfile = "condor/condor_"+base+".cmd" | ||
f = open(subfile,"w") | ||
f.write("Universe = vanilla\n") | ||
f.write("Executable = "+executable+"\n") | ||
f.write("Arguments = "+(' '.join(options))+"\n") | ||
f.write("Should_Transfer_Files = YES\n") | ||
f.write("Transfer_Input_Files = "+infile+"\n") | ||
f.write("Transfer_Output_Files = "+os.path.basename(outfile)+"\n") | ||
f.write('Transfer_Output_Remaps = "'+os.path.basename(outfile)+"="+outfile+'"\n') | ||
f.write("WhenToTransferOutput = ON_EXIT\n") | ||
f.write("Output = condor/"+base+".out.$(Cluster).$(Process)\n") | ||
f.write("Log = condor/"+base+".log.$(Cluster).$(Process)\n") | ||
f.write("Error = condor/"+base+".err.$(Cluster).$(Process)\n") | ||
f.write("Notification = Never\n") | ||
f.write("x509userproxy={0}\n".format(proxy)) | ||
f.write("Queue 1\n") | ||
f.close() | ||
|
||
cmd = "condor_submit "+subfile | ||
print cmd | ||
if submit: | ||
os.system(cmd) | ||
|
||
if __name__ == '__main__': | ||
# assumes this script is in the same directory as the executable | ||
local_dir = os.path.dirname(os.path.realpath(__file__))+'/' | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('infile', help="Full path to input file") | ||
parser.add_argument('--no-sub', dest='noSub', action='store_true', | ||
help='Do not submit jobs') | ||
parser.add_argument('--proxy', dest="proxy", help="Path to proxy", | ||
default='/tmp/x509up_u48463') | ||
parser.add_argument('--out-dir', dest='outDir', help='Output directory', | ||
default=local_dir) | ||
parser.add_argument('--config', help='Config file', default='15may2017.config') | ||
args = parser.parse_args() | ||
|
||
outfile_local = os.path.basename(args.infile.replace('.dat', '.root')) | ||
outfile = args.outDir+'/'+outfile_local | ||
executable = local_dir+'/runDat2Root' | ||
|
||
infiles = [ | ||
local_dir+args.infile, | ||
local_dir+"config/"+args.config, | ||
local_dir+"v1740_bd1_group_0_dV.txt", | ||
local_dir+"v1740_bd1_group_0_offset.txt", | ||
local_dir+"v1740_bd1_group_1_dV.txt", | ||
local_dir+"v1740_bd1_group_1_offset.txt", | ||
local_dir+"v1740_bd1_group_2_dV.txt", | ||
local_dir+"v1740_bd1_group_2_offset.txt", | ||
local_dir+"v1740_bd1_group_3_dV.txt", | ||
local_dir+"v1740_bd1_group_3_offset.txt", | ||
] | ||
infiles = ', '.join(infiles) | ||
|
||
options = [local_dir, | ||
os.path.basename(args.infile), | ||
outfile_local, | ||
args.config] | ||
print "runDat2Root options:",(' '.join(options)) | ||
submitCondorJob(executable, options, infiles, outfile, | ||
submit=(not args.noSub), proxy=args.proxy) |