46 |
|
self.dataTiers = dataTiers |
47 |
|
self.cfg_params = cfg_params |
48 |
|
|
49 |
< |
self.evcinfo = {} # DBS output: map fileblocks-events for collection |
49 |
> |
self.eventsPerBlock = {} # DBS output: map fileblocks-events for collection |
50 |
> |
self.eventsPerFile = {} # DBS output: map files-events |
51 |
|
self.blocksinfo = {} # DBS output: map fileblocks-files |
52 |
|
#DBS output: max events computed by method getMaxEvents |
53 |
|
|
57 |
|
Contact DBS |
58 |
|
""" |
59 |
|
|
60 |
+ |
## get DBS URL |
61 |
+ |
try: |
62 |
+ |
dbs_url=self.cfg_params['CMSSW.dbs_url'] |
63 |
+ |
except KeyError: |
64 |
+ |
# This URL is deprecated and no longer supported by the DBS team |
65 |
+ |
#dbs_url="http://cmsdoc.cern.ch/cms/aprom/DBS/CGIServer/prodquery" |
66 |
+ |
# This URL is supported by the DBS team and is 'stable' |
67 |
+ |
dbs_url="http://cmsdoc.cern.ch/cms/test/aprom/DBS/CGIServer/prodquery" |
68 |
+ |
# This URL is used for testing of the most recent changes by the DBS team |
69 |
+ |
#dbs_url = "http://cmsdoc.cern.ch/cms/test/aprom/DBS/CGIServer/prodquerytest" |
70 |
+ |
|
71 |
|
## get info about the requested dataset |
72 |
|
try: |
73 |
|
dbs_instance=self.cfg_params['CMSSW.dbs_instance'] |
74 |
|
except KeyError: |
75 |
|
dbs_instance="MCLocal/Writer" |
76 |
|
|
77 |
< |
dbs = DBSInfo_EDM(dbs_instance) |
77 |
> |
dbs = DBSInfo_EDM(dbs_url, dbs_instance) |
78 |
|
self.datasets = dbs.getMatchingDatasets(self.datasetPath) |
79 |
|
if len(self.datasets) == 0: |
80 |
|
raise DataDiscoveryError("DatasetPath=%s unknown to DBS" %self.datasetPath) |
84 |
|
try: |
85 |
|
self.dbsdataset = self.datasets[0].get('datasetPathName') |
86 |
|
|
87 |
< |
self.evcinfo = dbs.getDatasetContents(self.dbsdataset) |
87 |
> |
self.eventsPerBlock = dbs.getEventsPerBlock(self.dbsdataset) |
88 |
|
self.blocksinfo = dbs.getDatasetFileBlocks(self.dbsdataset) |
89 |
+ |
self.eventsPerFile = dbs.getEventsPerFile(self.dbsdataset) |
90 |
|
except DBSError, ex: |
91 |
|
raise DataDiscoveryError(ex.getErrorMessage()) |
92 |
|
|
93 |
< |
if len(self.evcinfo) <= 0: |
93 |
> |
if len(self.eventsPerBlock) <= 0: |
94 |
|
raise NotExistingDatasetError (("\nNo data for %s in DBS\nPlease check" |
95 |
|
+ " dataset path variables in crab.cfg") |
96 |
|
% self.dbsdataset) |
104 |
|
""" |
105 |
|
## loop over the event collections |
106 |
|
nevts=0 |
107 |
< |
for evc_evts in self.evcinfo.values(): |
107 |
> |
for evc_evts in self.eventsPerBlock.values(): |
108 |
|
nevts=nevts+evc_evts |
109 |
|
|
110 |
|
return nevts |
111 |
|
|
112 |
|
# ################################################# |
113 |
< |
def getEVC(self): |
113 |
> |
def getEventsPerBlock(self): |
114 |
|
""" |
115 |
|
list the event collections structure by fileblock |
116 |
|
""" |
117 |
< |
print "To be used by a more complex job splitting... TODO later... " |
118 |
< |
print "it requires changes in what's returned by DBSInfo.getDatasetContents and then fetchDBSInfo" |
117 |
> |
return self.eventsPerBlock |
118 |
> |
|
119 |
> |
# ################################################# |
120 |
> |
def getEventsPerFile(self): |
121 |
> |
""" |
122 |
> |
list the event collections structure by file |
123 |
> |
""" |
124 |
> |
return self.eventsPerFile |
125 |
|
|
126 |
|
# ################################################# |
127 |
|
def getFiles(self): |