diff --git a/Database/CoolRunQuery/python/AtlRunQueryOptions.py b/Database/CoolRunQuery/python/AtlRunQueryOptions.py index 7ce9629145615e4d05f69207ec25e10425ed47ee..45251bb7a377516d2bf449afea8749c9b9146df4 100644 --- a/Database/CoolRunQuery/python/AtlRunQueryOptions.py +++ b/Database/CoolRunQuery/python/AtlRunQueryOptions.py @@ -237,7 +237,7 @@ class AtlRunQueryOptions: def splitCmdline(self,argstring): arg = argstring.split() - m = zip([x for x in range(len(arg)) if arg[x][0]=='"'],[x for x in range(len(arg)) if arg[x][-1]=='"']) + m = list(zip([x for x in range(len(arg)) if arg[x][0]=='"'],[x for x in range(len(arg)) if arg[x][-1]=='"'])) m.reverse() for p in m: if p[0]==p[1]: diff --git a/Database/CoolRunQuery/python/AtlRunQueryParser.py b/Database/CoolRunQuery/python/AtlRunQueryParser.py index 8545bfe39b64e8f6a8efead4a72bed077bbb4c92..4fb1777d1ca530f080dca2415dddf649922d221c 100755 --- a/Database/CoolRunQuery/python/AtlRunQueryParser.py +++ b/Database/CoolRunQuery/python/AtlRunQueryParser.py @@ -67,7 +67,7 @@ class ArgumentParser: "release": ("rel(ease)", "release", self.InterpretString, self.ShowWithArg, 'rel(ease) [format: "release 15.1.*" ',""), "projectTag": ("ptag", "projecttag",self.InterpretString, self.ShowVariable, - 'ptag [format: "ptag data08_cos,data08_cosmag,data09_cos", "ptag data08_cos*,data09_cos" (note: the projectTag in dataset name / denoted "filenamtTag" in COOL)]',"data0*,data1*"), + 'ptag [format: "ptag data08_cos,data08_cosmag,data09_cos", "ptag data08_cos*,data09_cos" (note: the projectTag in dataset name / denoted "filenamtTag" in COOL)]',"data0*,data1*,data2*"), "partition": ("p(artition)", "partition", self.InterpretString, self.ShowVariable, 'p(artition) [format: "partition ATLAS"]', "ATLAS"), "readyforphysics": ("ready(forphysics)", "readyforphysics", self.InterpretString, self.ShowVariable, diff --git a/Database/CoolRunQuery/python/AtlRunQuerySelectorWorker.py b/Database/CoolRunQuery/python/AtlRunQuerySelectorWorker.py index 3ad4f892c31acbd1e8bf14ffcde71674fca26bf0..0223c03f1d75582218110578a61d4fab9fe7f121 100644 --- a/Database/CoolRunQuery/python/AtlRunQuerySelectorWorker.py +++ b/Database/CoolRunQuery/python/AtlRunQuerySelectorWorker.py @@ -4,11 +4,11 @@ #import the selectors from __future__ import print_function from CoolRunQuery.selector.AtlRunQuerySelectorDQ import DQSelector -from CoolRunQuery.selector.AtlRunQuerySelectorTrigger import TrigKeySelector, TriggerSelector +from CoolRunQuery.selector.AtlRunQuerySelectorTrigger import TrigKeySelector, TriggerSelector, L1TrigKeySelector, HLTTrigKeySelector, BGSKeySelector # noqa: F401 from CoolRunQuery.selector.AtlRunQuerySelectorMisc import BPMSelector, LArcondSelector, DatasetsSelector, DetectorSelector, FilenameSelector, PartitionSelector, ReadyForPhysicsSelector, DurationSelector, BFieldSelector from CoolRunQuery.selector.AtlRunQuerySelectorEvents import EventSelector from CoolRunQuery.selector.AtlRunQuerySelectorStreams import StreamSelector -from CoolRunQuery.selector.AtlRunQuerySelectorLhcOlc import LHCSelector, OLCLumiSelector, LuminositySelector, BeamspotSelector +from CoolRunQuery.selector.AtlRunQuerySelectorLhcOlc import LHCSelector, OLCLumiSelector, LuminositySelector, BeamspotSelector, OLCLBDataCondition, OLCFillParamsCondition # noqa: F401 from CoolRunQuery.AtlRunQueryRun import Run diff --git a/Database/CoolRunQuery/python/output/AtlRunQueryRoot.py b/Database/CoolRunQuery/python/output/AtlRunQueryRoot.py index a7251d72fc6fc6cfa05b51e850944e43e73dda35..0292cf11c3be9a10ae7cd3ef7d21aae2ecfb060c 100644 --- a/Database/CoolRunQuery/python/output/AtlRunQueryRoot.py +++ b/Database/CoolRunQuery/python/output/AtlRunQueryRoot.py @@ -671,7 +671,7 @@ def InttypeTrf( tree, var, vlist, value, kcoord ): # fill tree try: vlist[kcoord][0] = int(value) - except ValueError: + except (ValueError, TypeError): vlist[kcoord][0] = -1 def FloattypeTrf( tree, var, vlist, value, kcoord ): @@ -684,21 +684,21 @@ def FloattypeTrf( tree, var, vlist, value, kcoord ): # fill tree try: vlist[kcoord][0] = float(value) - except ValueError: + except (ValueError, TypeError): vlist[kcoord][0] = -1 def StringtypeTrf( tree, var, vlist, value, kcoord ): # initialisation if kcoord < 0: - vlist.append( array( 'c', 'ab\0' ) ) + vlist.append( array( 'b', 'ab\0'.encode() ) ) tree.Branch( var, vlist[-1], "%s/C" % var ) return # fill tree try: - vlist[kcoord] = array( 'c', value + '\0' ) + vlist[kcoord] = array( 'b', (value + '\0').encode() ) tree.SetBranchAddress( var, vlist[kcoord] ) - except ValueError: - vlist[kcoord] = array( 'c', 'unknown\0' ) + except (ValueError, TypeError): + vlist[kcoord] = array( 'b', 'unknown\0'.encode() ) tree.SetBranchAddress( var, vlist[kcoord] ) def TimetypeTrf( tree, var, vlist, value, kcoord ): @@ -721,7 +721,7 @@ def DurationtypeTrf( tree, var, vlist, value, kcoord ): value = str( ( (int(d.replace('d','').strip())*24 + int(h.replace('h','').strip()))*60 + int(m.replace('m','').strip()) )*60 + int(s.replace('s','').strip()) ) - except ValueError: + except (ValueError, TypeError): print (value) sys.exit(1) value = 0 @@ -816,7 +816,6 @@ def CreateRootFile( dic ): # loop over runs for ev in range(len(dic[DataKey('Run')])): - for k,(data_key,var,function) in enumerate(keylist): val = dic[data_key][ev] diff --git a/Database/CoolRunQuery/python/selector/AtlRunQuerySelectorTrigger.py b/Database/CoolRunQuery/python/selector/AtlRunQuerySelectorTrigger.py index c48ff77a28bbe0fa4fcda7b358f58c0740efed1b..0dbf75082a01ce7af16580c293219b3f923bf21e 100644 --- a/Database/CoolRunQuery/python/selector/AtlRunQuerySelectorTrigger.py +++ b/Database/CoolRunQuery/python/selector/AtlRunQuerySelectorTrigger.py @@ -135,7 +135,10 @@ class TrigKeySelector(RunLBBasedCondition): for run in runlist: smk = run.result['SMK'] - info = list(smknames[int(smk)] if str.isdigit(smk) else ("","","")) + if str.isdigit(smk) and int(smk) in smknames: + info = list(smknames[int(smk)]) + else: + info = ["unknown",0,"no comment"] if info[2]=="" or info[2]=="~": info[2]="no comment" run.stats[k] = { "info" : tuple(info), diff --git a/Database/CoolRunQuery/python/utils/AtlRunQueryTriggerUtils.py b/Database/CoolRunQuery/python/utils/AtlRunQueryTriggerUtils.py index 9ecb8766951d12cba9688ab302c9f811c68d3afb..9cc5682b04f706aa38bc22837ec26b6ca3ba404d 100755 --- a/Database/CoolRunQuery/python/utils/AtlRunQueryTriggerUtils.py +++ b/Database/CoolRunQuery/python/utils/AtlRunQueryTriggerUtils.py @@ -609,9 +609,10 @@ def getRandom(smk): cursor,schema = getTriggerDBCursor(smk=smk) res = executeQuery(cursor, output, condition, schema, tables, bindvars) - - return res[0] - + if len(res) > 0: + return res[0] + else: + return [0,0,0,0] if __name__=="__main__": diff --git a/Database/CoolRunQuery/python/utils/AtlRunQueryUtils.py b/Database/CoolRunQuery/python/utils/AtlRunQueryUtils.py index a526dd8849cc800b96a3a9170aeaa6831d1a662a..039ea4b84382be271da518c45518baf1df740760 100644 --- a/Database/CoolRunQuery/python/utils/AtlRunQueryUtils.py +++ b/Database/CoolRunQuery/python/utils/AtlRunQueryUtils.py @@ -165,10 +165,9 @@ class DBConnectionController: def GetSFODBConnection(self): if 'sfo' not in self.openConn: - #auth = self.get_auth('oracle://ATLAS_CONFIG/ATLAS_SFO_T0') - #self.openConn['sfo'] = cx_Oracle.connect("%s/%s@ATLAS_CONFIG" % (auth['user'],auth['password'])) + auth = self.get_auth('oracle://ATLAS_CONFIG/ATLAS_SFO_T0_R') with timer("Opening Connection to ATLAS_SFO_T0_R @ ATLAS_CONFIG"): - self.openConn['sfo'] = cx_Oracle.connect("ATLAS_SFO_T0_R/readmesfotz2008@ATLAS_CONFIG") + self.openConn['sfo'] = cx_Oracle.connect("%s/%s@ATLAS_CONFIG" % (auth['user'],auth['password'])) return self.openConn['sfo'] def GetTier0DBConnection(self):