Skip to content

Commit

Permalink
Merge branch 'develop' into remove_finaliseOnMaster
Browse files Browse the repository at this point in the history
  • Loading branch information
mesmith75 authored Jun 20, 2024
2 parents 25b61b7 + fda9fc4 commit a14d57b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ganga/GangaLHCb/Lib/LHCbDataset/BKQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class BKQuery(GangaObject):
doc='Return the data set, even if all the LFNs are archived')
schema['SMOG2'] = SimpleItem(defvalue='', typelist=['str', 'list'],
doc='Specify the state of SMOG2')
schema['retry_limit'] = SimpleItem(defvalue=1, typelist=['int'],
doc='Number of times to retry the DIRAC commands')
_schema = Schema(Version(1, 2), schema)
_category = 'query'
_name = "BKQuery"
Expand Down Expand Up @@ -135,7 +137,8 @@ def getDatasetMetadata(self):
self.type, self.startDate, self.endDate, self.selection, self.SMOG2)

try:
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements)
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements,
retry_limit = self.retry_limit)
except GangaDiracError as err:
return {'OK': False, 'Value': str(err)}

Expand Down Expand Up @@ -176,7 +179,7 @@ def getDataset(self, compressed=True, SE=None):
if isType(self.dqflag, knownLists):
cmd = "getDataset('%s',%s,'%s','%s','%s','%s', %s)" % (self.path, self.dqflag, self.type, self.startDate,
self.endDate, self.selection, self.SMOG2)
result = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements)
result = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements, retry_limit = self.retry_limit)
logger.debug("Finished Running Command")
files = []
value = result
Expand Down Expand Up @@ -205,7 +208,8 @@ def getDataset(self, compressed=True, SE=None):
if isMC and self.check_archived:
logger.debug('Detected an MC data set. Checking if it has been archived')
all_reps = get_result("getReplicas(%s)" % files, 'Get replica error.',
credential_requirements=self.credential_requirements)
credential_requirements=self.credential_requirements,
retry_limit = self.retry_limit)
if 'Successful' in all_reps:
all_ses = set([])
for _lfn, _repz in all_reps['Successful'].items():
Expand All @@ -214,7 +218,8 @@ def getDataset(self, compressed=True, SE=None):
all_archived = True
for _se in all_ses:
is_archived = get_result("isSEArchive('%s')" % _se, 'Check archive error.',
credential_requirements=self.credential_requirements)
credential_requirements=self.credential_requirements,
retry_limit = self.retry_limit)
if not is_archived:
all_archived = False
break
Expand Down Expand Up @@ -294,7 +299,8 @@ def getDatasetMetadata(self):
return None
cmd = 'bkQueryDict(%s)' % self.dict
try:
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements)
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements,
retry_limit = self.retry_limit)
except GangaDiracError as err:
return {'OK': False, 'Value': {}}

Expand All @@ -316,7 +322,8 @@ def getDataset(self):
if not self.dict:
return None
cmd = 'bkQueryDict(%s)' % self.dict
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements)
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements,
retry_limit = self.retry_limit)

files = []
if 'LFNs' in value:
Expand Down

0 comments on commit a14d57b

Please sign in to comment.