Skip to content

Commit

Permalink
Merge pull request #2342 from ganga-devs/smog_bk
Browse files Browse the repository at this point in the history
Add SMOG options in BKQuery
  • Loading branch information
mesmith75 authored May 24, 2024
2 parents 5596a5e + 1d12fcb commit e0cbeea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
18 changes: 10 additions & 8 deletions ganga/GangaLHCb/Lib/LHCbDataset/BKQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class BKQuery(GangaObject):
schema['check_archived'] = SimpleItem(defvalue=True, typelist=['bool'], doc='Check if the data set is archived')
schema['ignore_archived'] = SimpleItem(defvalue=False, typelist=['bool'],
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 = Schema(Version(1, 2), schema)
_category = 'query'
_name = "BKQuery"
Expand All @@ -124,13 +126,13 @@ def getDatasetMetadata(self):
if self.selection:
msg = 'selection not supported for type="%s".' % self.type
raise GangaException(msg)
cmd = "getDataset('%s','%s','%s','%s','%s','%s')" % (self.path, self.dqflag,
self.type, self.startDate, self.endDate, self.selection)
cmd = "getDataset('%s','%s','%s','%s','%s','%s', '%s')" % (self.path, self.dqflag,
self.type, self.startDate, self.endDate, self.selection, self.SMOG2)
from GangaCore.GPIDev.Lib.GangaList.GangaList import GangaList
knownLists = [tuple, list, GangaList]
if isType(self.dqflag, knownLists):
cmd = "getDataset('%s',%s,'%s','%s','%s','%s')" % (self.path, self.dqflag,
self.type, self.startDate, self.endDate, self.selection)
cmd = "getDataset('%s',%s,'%s','%s','%s','%s', '%s')" % (self.path, self.dqflag,
self.type, self.startDate, self.endDate, self.selection, self.SMOG2)

try:
value = get_result(cmd, 'BK query error.', credential_requirements=self.credential_requirements)
Expand Down Expand Up @@ -167,13 +169,13 @@ def getDataset(self, compressed=True, SE=None):
if self.selection:
msg = 'selection not supported for type="%s".' % self.type
raise GangaException(msg)
cmd = "getDataset('%s','%s','%s','%s','%s','%s')" % (self.path, self.dqflag,
self.type, self.startDate, self.endDate, self.selection)
cmd = "getDataset('%s','%s','%s','%s','%s','%s', %s)" % (self.path, self.dqflag,
self.type, self.startDate, self.endDate, self.selection, self.SMOG2)
from GangaCore.GPIDev.Lib.GangaList.GangaList import GangaList
knownLists = [tuple, list, GangaList]
if isType(self.dqflag, knownLists):
cmd = "getDataset('%s',%s,'%s','%s','%s','%s')" % (self.path, self.dqflag, self.type, self.startDate,
self.endDate, self.selection)
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)
logger.debug("Finished Running Command")
files = []
Expand Down
10 changes: 5 additions & 5 deletions ganga/GangaLHCb/Lib/Server/DiracLHCbCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ def bookkeepingGUI(file):


@diracCommand
def getDataset(path, dqflag, this_type, start, end, sel):
def getDataset(path, dqflag, this_type, start, end, sel, smog=None):
if this_type == 'Path':
result = dirac.bkQueryPath(path, dqflag) # dirac
result = dirac.bkQueryPath(path, dqflag, SMOG2=smog) # dirac
elif this_type == 'RunsByDate':
result = dirac.bkQueryRunsByDate(path, start, end,
dqflag, sel) # dirac
dqflag, sel, SMOG2=smog) # dirac
elif this_type == 'Run':
result = dirac.bkQueryRun(path, dqflag) # dirac
result = dirac.bkQueryRun(path, dqflag, SMOG2=smog) # dirac
elif this_type == 'Production':
result = dirac.bkQueryProduction(path, dqflag) # dirac
result = dirac.bkQueryProduction(path, dqflag, SMOG2=smog) # dirac
else:
result = {'OK': False, 'Message': 'Unsupported type!'}

Expand Down

0 comments on commit e0cbeea

Please sign in to comment.