ATLAS Offline Software
Loading...
Searching...
No Matches
python.GoodRunsListTool Namespace Reference

Functions

 importModule (moduleName, className, objectName="")
 getObjectOfClass (moduleName, className="")
 createAndVerifyGRL (configModule, prefix="")
 createGRL (configModule, prefix="")
 verifyGRL (xmlfile)

Function Documentation

◆ createAndVerifyGRL()

python.GoodRunsListTool.createAndVerifyGRL ( configModule,
prefix = "" )

Definition at line 35 of file GoodRunsListTool.py.

35def createAndVerifyGRL(configModule,prefix=""):
36 xmlfile = createGRL(configModule,prefix)
37 allOk = verifyGRL(xmlfile)
38 return (allOk,xmlfile)
39

◆ createGRL()

python.GoodRunsListTool.createGRL ( configModule,
prefix = "" )

Definition at line 40 of file GoodRunsListTool.py.

40def createGRL(configModule,prefix=""):
41 from CoolRunQuery.AtlRunQueryLib import AtlRunQuery
42 from CoolRunQuery.AtlRunQueryOptions import AtlRunQueryOptions
43 from CoolRunQuery.AtlRunQueryParser import ArgumentParser
44
45
46 config = getObjectOfClass(configModule)
47 config.setPrefix(prefix)
48 query = config.getsearchquery()
49 print (">> Calling cmd equivalent of: ")
50 print ("%s \"%s\"" % (config.querytool,query))
51
52
53 ap = ArgumentParser()
54 atlqueryarg = config.querytool + " " + ap.ParseArgument( query )
55 (options, args) = AtlRunQueryOptions().parse(atlqueryarg)
56
57 #print (atlqueryarg)
58 #print (options)
59
60
61 AtlRunQuery(options, html="NO", origQuery=query) # html can be "YES", "NO", "AUTO"
62
63 xmlfile = 'data/'+config.listname
64 print (">> Good-run list stored as: \'%s\'" % xmlfile)
65 return xmlfile
66
std::map< std::string, std::string > parse(const std::string &list)

◆ getObjectOfClass()

python.GoodRunsListTool.getObjectOfClass ( moduleName,
className = "" )

Definition at line 16 of file GoodRunsListTool.py.

16def getObjectOfClass(moduleName,className=""):
17 moduleArr = moduleName.split(".")
18 if len(moduleArr)==2:
19 libraryName = moduleArr[0]
20 else: libraryName = "GoodRunsLists"
21 configModule = moduleArr[len(moduleArr)-1]
22 if len(className)==0: className=configModule
23
24 try:
25 cls = importModule (libraryName,configModule,className)
26 except Exception:
27 try:
28 cls = importModule (configModule,className)
29 except Exception:
30 print ("Could not import configuration module \'" + configModule + "\'")
31 sys.exit(1)
32
33 return cls()
34

◆ importModule()

python.GoodRunsListTool.importModule ( moduleName,
className,
objectName = "" )

Definition at line 6 of file GoodRunsListTool.py.

6def importModule(moduleName,className,objectName=""):
7 if len(objectName)==0: objectName=className
8 if len(moduleName)>0:
9 modname = '%s.%s' % (moduleName,className)
10 else:
11 modname = className
12 import importlib
13 mod = importlib.import_module (modname)
14 return getattr (mod, objectName)
15

◆ verifyGRL()

python.GoodRunsListTool.verifyGRL ( xmlfile)

Definition at line 67 of file GoodRunsListTool.py.

67def verifyGRL(xmlfile):
68
69 CWD = os.getcwd()
70
73 from ROOT import gSystem
74 os.chdir(CWD)
75
76 gSystem.Load('libGoodRunsListsLib')
77 from ROOT import Root
78
80
81 reader.SetXMLFile(xmlfile)
82 reader.Interpret()
83
84 grlcollection = reader.GetMergedGRLCollection()
85 print (">> Found %d independent good-run list(s). Now checking content." % len(grlcollection))
86
87 allOk = True
88
89
90 for idx in range(len(grlcollection)):
91 grl = grlcollection[idx]
92 grlName = grl.GetName()
93 grlVersion = grl.GetVersion()
94 grlMDSize = grl.GetMetaDataSize()
95 grlIsEmpty = grl.IsEmpty()
96 if len(grlName)==0:
97 print (">> ERROR: good run list %d has no name." % (idx))
98 allOk = False
99 if len(grlVersion)==0:
100 print (">> ERROR: good run list %d, with name \'%s\', has no version." % (idx,grlName))
101 allOk = False
102 if grlMDSize==0:
103 print (">> ERROR: good run list %d, with name \'%s\', has no metadata." % (idx,grlName))
104 allOk = False
105 if grlIsEmpty:
106 print (">> ERROR: good run list %d, with name \'%s\', has no run(s) and lumi-block range(s)." % (idx,grlName))
107 allOk = False
108
109 if allOk:
110 print (">> Content okay.")
111
112 return allOk
113