Functions | Variables
submit_reco_validation Namespace Reference

Functions

def make_grid_config_file (dataset)
 
def make_fhicl_file (dataset)
 
def record_output_path (datset)
 
def source_script (filename)
 

Variables

 parser = argparse.ArgumentParser()
 
 type
 
 str
 
 help
 
 default
 
 args = parser.parse_args()
 
 config_file = args.config_file
 
list sam_datasets = [x.strip().strip('\n') for x in parser.get('sam', 'defnames').split('\n')]
 
 nfiles = parser.get('sam', 'number_of_files')
 
 working_dir = parser.get('working folder', 'path')
 
 jobname = parser.get('grid configuration', 'jobname')
 
 fcl = parser.get('grid configuration', 'c')
 
 dest = parser.get('grid configuration', 'dest')
 
 testrel = parser.get('grid configuration', 'testrel')
 
 tag = parser.get('grid configuration', 'tag')
 
 histTier = parser.get('grid configuration', 'histTier')
 
 maxopt = parser.get('grid configuration', 'maxopt')
 
 group = parser.get('grid configuration', 'G')
 
 njobs = parser.get('grid configuration', 'njobs')
 
 files_per_job = parser.get('grid configuration', 'files_per_job')
 
 opportunistic = parser.get('grid configuration', 'opportunistic')
 
 copyOut = parser.get('grid configuration', 'copyOut')
 
 print_jobsub = parser.get('grid configuration', 'print_jobsub')
 
 expected_lifetime = parser.get('grid configuration', 'expected_lifetime')
 
list enabled_modules = [x.strip().strip('\n') for x in parser.get('art modules', 'enabled').split('\n')]
 
list complete_module_list
 
 cur_dest = os.path.join(dest, dataset)
 
string cmd = ''
 

Function Documentation

def submit_reco_validation.make_fhicl_file (   dataset)

Definition at line 29 of file submit_reco_validation.py.

References open().

29 def make_fhicl_file(dataset):
30  working_subdir = os.path.join(working_dir, dataset)
31  # copy a template from development
32  cmd = ''
33  if not 'SRT_DIST' in os.environ.keys(): cmd += '. ~/.bashrc;setup_nova;'
34  cmd += 'cp $SRT_PUBLIC_CONTEXT/RecoValidation/reco_validation_mc_job.fcl ' + working_subdir
35  os.system(cmd)
36  inflines = []
37  with open(os.path.join(working_subdir, 'reco_validation_mc_job.fcl')) as inf:
38  for line in inf: inflines.append(line)
39  with open(os.path.join(working_subdir, dataset+'.fcl'), 'w') as outf:
40  for line in inflines:
41  for module in complete_module_list:
42  if module in line:
43  if not module in enabled_modules:
44  line = '#'+line
45  outf.write(line)
46  # Clean up the copied file
47  os.system('rm -f ' + os.path.join(working_subdir, 'reco_validation_mc_job.fcl'))
48 
procfile open("FD_BRL_v0.txt")
def submit_reco_validation.make_grid_config_file (   dataset)

Definition at line 10 of file submit_reco_validation.py.

References open().

10 def make_grid_config_file(dataset):
11  working_subdir = os.path.join(working_dir, dataset)
12  with open(os.path.join(working_subdir, dataset+'.cfg'), 'w') as outf:
13  outf.write('--jobname '+dataset+'\n')
14  outf.write('--defname '+dataset+'\n')
15  outf.write('-c '+os.path.abspath(os.path.join(working_subdir, dataset+'.fcl'))+'\n')
16  outf.write('--dest '+os.path.join(dest, dataset)+'\n')
17  if testrel: outf.write('--testrel '+testrel+'\n')
18  if tag: outf.write('--tag '+tag+'\n')
19  outf.write('--histTier '+histTier+'\n')
20  if maxopt: outf.write('--maxopt\n')
21  outf.write('-G nova\n')
22  outf.write('--njobs '+njobs+'\n')
23  outf.write('--files_per_job '+files_per_job+'\n')
24  outf.write('--opportunistic\n')
25  outf.write('--copyOut\n')
26  outf.write('--print_jobsub\n')
27  outf.write('--expected_lifetime '+expected_lifetime+'\n')
28 
procfile open("FD_BRL_v0.txt")
def submit_reco_validation.record_output_path (   datset)

Definition at line 49 of file submit_reco_validation.py.

References open().

49 def record_output_path(datset):
50  written_paths = []
51  if os.path.exists(os.path.join(working_dir, 'hadd_reco_validation.cfg')):
52  with open(os.path.join(working_dir, 'hadd_reco_validation.cfg')) as inf:
53  for line in inf:
54  if line.strip('\n') not in written_paths: written_paths.append(line.strip('\n'))
55  cur_dest = os.path.join(dest, dataset)
56  if cur_dest.strip('\n') not in written_paths: written_paths.append(cur_dest.strip('\n'))
57  with open(os.path.join(working_dir, 'hadd_reco_validation.cfg'), 'w') as outf:
58  for line in written_paths: outf.write(line+'\n')
59 
procfile open("FD_BRL_v0.txt")
def submit_reco_validation.source_script (   filename)

Definition at line 60 of file submit_reco_validation.py.

References novadaq::HexUtils.format(), and split().

60 def source_script(filename):
61  proc = subprocess.Popen(['bash', '-c', 'source {0} && env'.format(filename)], stdout=subprocess.PIPE)
62  for tup in map(lambda s: s.strip().split('=', 1), proc.stdout):
63  if len(tup) > 1:
64  os.environ[tup[0].strip()] = tup[1].strip()
65 
66 #
67 # command line argument parsing
68 #
void split(double tt, double *fr)
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14

Variable Documentation

submit_reco_validation.args = parser.parse_args()

Definition at line 71 of file submit_reco_validation.py.

string submit_reco_validation.cmd = ''

Definition at line 132 of file submit_reco_validation.py.

list submit_reco_validation.complete_module_list
Initial value:
1 = [
2  'calhitana',
3  'slicerana',
4  'multihoughana',
5  'elasticarmsana',
6  'houghvertexana',
7  'fuzzykana',
8  'kalmantrackana',
9  'breakpointana',
10  'bpfenergyana',
11  'cosmictrackana',
12  'windowtrackana'
13  ]

Definition at line 105 of file submit_reco_validation.py.

submit_reco_validation.config_file = args.config_file

Definition at line 72 of file submit_reco_validation.py.

submit_reco_validation.copyOut = parser.get('grid configuration', 'copyOut')

Definition at line 100 of file submit_reco_validation.py.

submit_reco_validation.cur_dest = os.path.join(dest, dataset)

Definition at line 128 of file submit_reco_validation.py.

submit_reco_validation.default

Definition at line 70 of file submit_reco_validation.py.

submit_reco_validation.dest = parser.get('grid configuration', 'dest')

Definition at line 91 of file submit_reco_validation.py.

list submit_reco_validation.enabled_modules = [x.strip().strip('\n') for x in parser.get('art modules', 'enabled').split('\n')]

Definition at line 104 of file submit_reco_validation.py.

submit_reco_validation.expected_lifetime = parser.get('grid configuration', 'expected_lifetime')

Definition at line 102 of file submit_reco_validation.py.

submit_reco_validation.fcl = parser.get('grid configuration', 'c')

Definition at line 90 of file submit_reco_validation.py.

submit_reco_validation.files_per_job = parser.get('grid configuration', 'files_per_job')

Definition at line 98 of file submit_reco_validation.py.

submit_reco_validation.group = parser.get('grid configuration', 'G')

Definition at line 96 of file submit_reco_validation.py.

submit_reco_validation.help

Definition at line 70 of file submit_reco_validation.py.

submit_reco_validation.histTier = parser.get('grid configuration', 'histTier')

Definition at line 94 of file submit_reco_validation.py.

submit_reco_validation.jobname = parser.get('grid configuration', 'jobname')

Definition at line 89 of file submit_reco_validation.py.

submit_reco_validation.maxopt = parser.get('grid configuration', 'maxopt')

Definition at line 95 of file submit_reco_validation.py.

submit_reco_validation.nfiles = parser.get('sam', 'number_of_files')

Definition at line 86 of file submit_reco_validation.py.

submit_reco_validation.njobs = parser.get('grid configuration', 'njobs')

Definition at line 97 of file submit_reco_validation.py.

submit_reco_validation.opportunistic = parser.get('grid configuration', 'opportunistic')

Definition at line 99 of file submit_reco_validation.py.

submit_reco_validation.parser = argparse.ArgumentParser()

Definition at line 69 of file submit_reco_validation.py.

submit_reco_validation.print_jobsub = parser.get('grid configuration', 'print_jobsub')

Definition at line 101 of file submit_reco_validation.py.

list submit_reco_validation.sam_datasets = [x.strip().strip('\n') for x in parser.get('sam', 'defnames').split('\n')]

Definition at line 85 of file submit_reco_validation.py.

submit_reco_validation.str

Definition at line 70 of file submit_reco_validation.py.

submit_reco_validation.tag = parser.get('grid configuration', 'tag')

Definition at line 93 of file submit_reco_validation.py.

submit_reco_validation.testrel = parser.get('grid configuration', 'testrel')

Definition at line 92 of file submit_reco_validation.py.

submit_reco_validation.type

Definition at line 70 of file submit_reco_validation.py.

submit_reco_validation.working_dir = parser.get('working folder', 'path')

Definition at line 87 of file submit_reco_validation.py.