136 parser = argparse.ArgumentParser(description=
'Check status of datasets based on DSIDs and AMI tags. Written by C. Ohm & M. Tripiana')
137 parser.add_argument(
'-p',
'--projectTag', type=str, nargs=
'?', help=
'Project tag, defaults to "mc15_13TeV"', default=
'mc15_13TeV')
138 parser.add_argument(
'-d',
'--dsids', type=str, nargs=
'?', help=
'Text file(s) containing DSIDs', default=
'')
139 parser.add_argument(
'-f',
'--format', type=str, help=
'Format: DAOD_SUSY1 (default), DAOD_SUSY2, ...', default=
'DAOD_SUSY1')
140 parser.add_argument(
'-v',
'--verbose', action=
'store_true', default=
False, help=
'Verbose mode, more detailed output and commands, etc')
141 parser.add_argument(
'-o',
'--outfile', nargs=
'?', type=argparse.FileType(
'w'), help=
'Save the dict holding the sample info to a pickle file')
142 parser.add_argument(
'-i',
'--infile', nargs=
'?', type=argparse.FileType(
'r'), help=
'Open a pickle file containing a dict from a previous session')
144 args = parser.parse_args()
149 with args.infile
as handle:
150 samples = pickle.load(handle)
160 dsids = [line.rstrip(
'\n')
for line
in f]
165 if not dsid
or dsid.startswith(
'#'):
168 print "Checking DSID %s..." % dsid
169 samples[dsid] =
getSamplesFromPattern(dsid.strip(), args.projectTag, defaultSimTags, defaultRecoTags, args.verbose, args.format, defaultDerivationTags)
172 print "These samples were found:"
174 print "DSID: %s" % dsid
175 for ds
in samples[dsid]:
176 print " %s: %s" % (ds, samples[dsid][ds])
180 for ds
in samples[dsid].
keys():
182 samples[dsid][ds+
"status"] =
" N/A "
183 samples[dsid][ds+
"status"] =
getAmiStatus(samples[dsid][ds], args.verbose)
185 print "Done, here is the status of your samples"
187 print "Here's the dict holding all the extracted info:"
191 with args.outfile
as handle:
192 pickle.dump(samples, handle)
193 print "Python dict with sample info saved to %s - you can read it in with the -i option" % args.outfile.name