20 __version__ =
"$Revision: 1.4 $"
21 __author__ =
"Sebastien Binet <binet@cern.ch>"
23 a simple python script to run pyathena and use PySgDumper to dump
24 a (set of) event(s) from a POOL (esd/aod) file into an ASCII file\
27 from optparse
import OptionParser
29 import PyDumper.SgDumpLib
as SgDumpLib
32 """translate a string into a python slice
34 sl= [
int(s)
if s !=
'' else None for s
in slice_str.split(
':')]
37 assert len(sl)==3,
'invalid input slice string'
41 return slice (start, stop, step)
43 if __name__ ==
"__main__":
44 parser = OptionParser(
45 usage=
"usage: %prog [options] -o out.ascii in1.pool "\
46 "[in2.pool [in3.pool [...]]]"
48 _add = parser.add_option
53 help =
"Name of the output file which will contain the informations"\
54 " gathered during athena processing. These informations "\
55 "will be stored into an ascii file.")
61 help =
"list of events or event-max or (python) slice of events."\
62 " (dummy for now: only understand event-max syntax)")
68 help =
"number of events to skip.")
73 help =
"tell application to save the automatically generated "\
74 "joboption under some name for (mainly) debugging "\
75 "and/or customization purposes.")
79 action =
"store_true",
81 help =
"switch to enable the attempt at removing all the (temporary) files sg-dump produces during the course of its execution")
85 action =
"store_false",
86 help =
"switch to enable the attempt at removing all the (temporary) files sg-dump produces during the course of its execution")
91 help =
"space-separated list of athena command-line options. "\
92 "these will be passed to the validation job. (e.g. "\
93 "'--perfmon --stdcmalloc')" )
97 default =
"PyDumper.PyComps:PySgDumper",
98 help =
"name of the class to use to process the file(s) content (default: '%default'. validation uses: 'PyDumper.PyComps:DataProxyLoader')")
103 help =
"comma-separated list of type#key containers to dump (default: all)")
108 help =
"comma-separated list of glob patterns of keys/types to ignore")
110 _add(
"--conditions-tag",
111 dest =
"conditions_tag",
113 help =
"override setting of global conditions tag")
117 action =
"store_true",
119 help =
"preserve full log file")
121 (options, args) = parser.parse_args()
125 from AthenaCommon.Logging
import logging
126 msg = logging.getLogger (
'sg-dumper')
127 msg.setLevel (logging.INFO)
131 input_files = [arg
for arg
in args
if arg[0] !=
"-"]
134 if len(input_files) == 0
or options.oname
is None:
136 msg.error(
'please provide an output filename and '
137 'at least one input file')
142 sc, out = SgDumpLib.run_sg_dump(
144 output=options.oname,
147 dump_jobo=options.dump_jobo,
148 pyalg_cls=options.pyalg_cls,
149 include=options.include,
150 exclude=options.exclude,
151 do_clean_up=options.do_clean_up,
152 athena_opts=options.athena_opts,
153 conditions_tag = options.conditions_tag,
154 full_log = options.full_log,
157 except Exception
as err:
158 msg.error(
'problem while running sg-dump:\n%s', err)
160 traceback.print_exc()