6 from PhysicsTools.HeppyCore.utils.dataset
import createDataset
8 if __name__ ==
'__main__':
11 from optparse
import OptionParser
14 parser = OptionParser()
15 parser.usage =
"%prog [options] <dataset>\nPrints information on a sample." 16 parser.add_option(
"-w",
"--wildcard", dest=
"wildcard", default=
'tree*root',help=
'A UNIX style wilfcard for root file printout')
17 parser.add_option(
"-u",
"--user", dest=
"user", default=os.environ.get(
'USER',
None),help=
'user owning the dataset.\nInstead of the username, give "LOCAL" to read datasets in a standard unix filesystem, and "CMS" to read official CMS datasets present at CERN.')
18 parser.add_option(
"-b",
"--basedir", dest=
"basedir", default=os.environ.get(
'CMGLOCALBASEDIR',
None),help=
'in case -u LOCAL is specified, this option allows to specify the local base directory containing the dataset. default is CMGLOCALBASEDIR')
19 parser.add_option(
"-a",
"--abspath", dest=
"abspath",
20 action =
'store_true',
22 help=
'print absolute path')
23 parser.add_option(
"-n",
"--noinfo", dest=
"noinfo",
24 action =
'store_true',
26 help=
'do not print additional info (file size and status)')
27 parser.add_option(
"-r",
"--report", dest=
"report",
28 action =
'store_true',
30 help=
'Print edmIntegrityCheck report')
31 parser.add_option(
"-c",
"--readcache", dest=
"readcache",
32 action =
'store_true',
34 help=
'Read from the cache.')
35 parser.add_option(
"--min-run", dest=
"min_run", default=-1, type=int, help=
'When querying DBS, require runs >= than this run')
36 parser.add_option(
"--max-run", dest=
"max_run", default=-1, type=int, help=
'When querying DBS, require runs <= than this run')
38 (options,args) = parser.parse_args()
46 info =
not options.noinfo
48 run_range = (options.min_run,options.max_run)
50 fnmatch.translate( options.wildcard ),
55 data.printFiles(abspath = options.abspath,
57 pprint.pprint( data.filesAndSizes )
59 pprint.pprint( data.report )
def createDataset(user, dataset, pattern, readcache=False, basedir=None, run_range=None)