8 __doc__ =
"read a POOL file and dump its content."
9 __author__ =
"Sebastien Binet"
13 import PyUtils.acmdlib
as acmdlib
15 @acmdlib.command(name=
'chk-file')
16 @acmdlib.argument(
'files', nargs=
'+',
17 help=
'path to the POOL file(s) to analyze')
18 @acmdlib.argument(
'-d',
'--detailed-dump',
21 help=
"""Switch to activate or not a detailed dump
22 of each TTree in the POOL file""")
23 @acmdlib.argument(
'--sort-fct',
24 choices=(
'diskSize',
'memSize',
'name'),
26 help=
"Sorting function used to list containers")
27 @acmdlib.argument(
'--fast',
30 help=
"""Enable fast mode.
31 Memory size will not be accurate AT ALL""")
32 @acmdlib.argument(
'-o',
'--output',
34 help=
"""name of the output file which will contain the
35 informations gathered during processing.
36 These informations will be stored into a python-shelve or
37 an ASCII/py file (depending on the extension:
38 .pkl,.dat -> shelve; everything else -> ASCII/py)
41 """read a POOL file and dump its content.
44 if isinstance(files, str):
50 for i,f
in enumerate(files):
51 files[i] = os.path.expandvars(os.path.expanduser(f))
56 import PyUtils.PoolFile
as PF
57 PF.PoolOpts.FAST_MODE = args.fast
58 pool_file = PF.PoolFile(fname)
59 pool_file.checkFile(sorting=args.sort_fct)
60 if args.detailed_dump:
61 dump_file = os.path.basename(fname) +
'.txt'
62 print (
"## dumping details into [%s]" % (dump_file,))
63 pool_file.detailedDump(dump_file)
66 print (
"## saving report into [%s]..." % (oname,))
67 pool_file.saveReport(oname)
68 except Exception
as e:
69 print (
"## Caught exception [%s] !!" %
str(e.__class__))
71 print (sys.exc_info()[0])
72 print (sys.exc_info()[1])