ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/DataDiscovery.py
(Generate patch)

Comparing COMP/CRAB/python/DataDiscovery.py (file contents):
Revision 1.46 by spiga, Wed Jun 2 13:55:14 2010 UTC vs.
Revision 1.48 by ewv, Tue Jul 6 16:31:55 2010 UTC

# Line 8 | Line 8 | import DBSAPI.dbsApi
8   from DBSAPI.dbsApiException import *
9   import common
10   from crab_util import *
11 < from LumiList import LumiList
11 > try: # Can remove when CMSSW 3.7 and earlier are dropped
12 >    from FWCore.PythonUtilities.LumiList import LumiList
13 > except ImportError:
14 >    from LumiList import LumiList
15 >
16   import os
17  
18  
# Line 136 | Line 140 | class DataDiscovery:
140          if not self.splitByRun:
141              self.splitByLumi = self.lumiMask or self.lumiParams or self.ads
142  
143 +        if self.splitByRun and not runselection:
144 +            msg = "Error: split_by_run must be combined with a runselection"
145 +            raise CrabException(msg)
146 +
147          ## service API
148          args = {}
149          args['url']     = dbs_url
# Line 223 | Line 231 | class DataDiscovery:
231  
232      def queryDbs(self,api,path=None,runselection=None,useParent=None):
233  
234 <        allowedRetriveValue = ['retrive_block', 'retrive_run']
235 <        if self.ads or self.lumiMask or self.lumiParams:
234 >
235 >        allowedRetriveValue = []
236 >        if self.splitByLumi or self.splitByRun or useParent == 1:
237 >            allowedRetriveValue.extend(['retrive_block', 'retrive_run'])
238 >        if self.splitByLumi:
239              allowedRetriveValue.append('retrive_lumi')
240 <        if useParent == 1: allowedRetriveValue.append('retrive_parent')
240 >        if useParent == 1:
241 >            allowedRetriveValue.append('retrive_parent')
242          common.logger.debug("Set of input parameters used for DBS query: %s" % allowedRetriveValue)
243          try:
244 <            if len(runselection) <=0 or self.splitByLumi:
245 <                if useParent==1 or self.splitByRun==1 or self.splitByLumi:
234 <                    if self.ads:
235 <                        files = api.listFiles(analysisDataset=path, retriveList=allowedRetriveValue)
236 <                    else :
237 <                        files = api.listFiles(path=path, retriveList=allowedRetriveValue)
238 <                else:
239 <                    files = api.listDatasetFiles(self.datasetPath)
240 <            else :
241 <                files=[]
244 >            if self.splitByRun:
245 >                files = []
246                  for arun in runselection:
247                      try:
248                          if self.ads:
# Line 251 | Line 255 | class DataDiscovery:
255                          common.logger.info(msg)
256                          pass
257  
258 +            else:
259 +                if allowedRetriveValue:
260 +                    if self.ads:
261 +                        files = api.listFiles(analysisDataset=path, retriveList=allowedRetriveValue)
262 +                    else :
263 +                        files = api.listFiles(path=path, retriveList=allowedRetriveValue)
264 +                else:
265 +                    files = api.listDatasetFiles(self.datasetPath)
266 +
267          except DbsBadRequest, msg:
268              raise DataDiscoveryError(msg)
269          except DBSError, msg:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines