|
def | getUsedTables (cls, output, condition) |
|
def | query (cls, output, condition, bindvars, verbose=False) |
|
def | cursor (cls) |
|
def | get_periods_for_run (cls, run) |
|
def | get_periods (cls, year=0, level=0) |
|
def | get_all_periods (cls) |
|
def | get_runs (cls, period, year) |
|
Definition at line 16 of file AtlRunQueryCOMA.py.
◆ cursor()
def python.AtlRunQueryCOMA.ARQ_COMA.cursor |
( |
|
cls | ) |
|
get COMA connection
any connection to ATLR is fine, we use Trigger DB
Definition at line 54 of file AtlRunQueryCOMA.py.
55 """get COMA connection
56 any connection to ATLR is fine, we use Trigger DB
60 from CoolRunQuery.utils.AtlRunQueryTriggerUtils
import interpretConnection
63 from cx_Oracle
import connect
64 connection = connect ( connectionParameters[
"user"],
65 connectionParameters[
"passwd"],
66 connectionParameters[
"server"], threaded=
True)
67 cls.__cursor = connection.cursor()
◆ get_all_periods()
def python.AtlRunQueryCOMA.ARQ_COMA.get_all_periods |
( |
|
cls | ) |
|
Definition at line 110 of file AtlRunQueryCOMA.py.
110 def get_all_periods(cls):
111 if cls.all_periods
is not None:
112 return cls.all_periods
114 p = re.compile(
r"(?P<periodletter>[A-Za-z]+)(?P<periodnumber>\d+)?$")
116 result = cls.get_periods(0, 0)
117 for period, projectName
in result:
118 year =
int(projectName[4:6])
121 print (
"Period '%s'does not match pattern [A-Za-z]+\\d+" % period)
124 period_letter = m.group(
'periodletter')
125 period_number =
int(m.group(
'periodnumber'))
if m.group(
'periodnumber')
else 0
126 if len(period_letter)!=1:
129 pc = 10000*year + 100*(ord(period_letter.upper())-65) + period_number
131 cls.all_periods += [ ((year, period, pc, projectName), projectName+
".period" + period) ]
133 cls.all_periods.sort()
136 traceback.print_exc()
138 return cls.all_periods
◆ get_periods()
def python.AtlRunQueryCOMA.ARQ_COMA.get_periods |
( |
|
cls, |
|
|
|
year = 0 , |
|
|
|
level = 0 |
|
) |
| |
Definition at line 92 of file AtlRunQueryCOMA.py.
92 def get_periods(cls, year=0, level=0):
93 output = [
'PR.P_PERIOD',
'PR.P_PROJECT' ]
98 condition += [
"PR.P_LEVEL=:lvl" ]
99 bindvars[
"lvl"] = level
102 project =
'data%02i%%' % (year-2000)
103 condition += [
"PR.P_PROJECT like :proj" ]
104 bindvars[
"proj"] = project
106 return sorted( cls.query(output, condition, bindvars) )
◆ get_periods_for_run()
def python.AtlRunQueryCOMA.ARQ_COMA.get_periods_for_run |
( |
|
cls, |
|
|
|
run |
|
) |
| |
Definition at line 76 of file AtlRunQueryCOMA.py.
76 def get_periods_for_run(cls, run):
81 if run
not in cls.__store:
82 output = [
'PR.P_LEVEL',
'PR.P_PERIOD',
'PR.P_PROJECT' ]
83 condition = [
"PR.RUN_INDEX = :run" ]
84 bindvars = {
"run": run }
86 cls.__store[run] =
sorted( cls.query(output, condition, bindvars) )
88 return [x[1]
for x
in cls.__store[run]]
◆ get_runs()
def python.AtlRunQueryCOMA.ARQ_COMA.get_runs |
( |
|
cls, |
|
|
|
period, |
|
|
|
year |
|
) |
| |
Definition at line 142 of file AtlRunQueryCOMA.py.
143 output = [
'PR.RUN_INDEX',
'PR.P_LEVEL',
'PR.P_PERIOD',
'PR.P_PROJECT' ]
145 condition = [
"PR.P_PERIOD=:period" ]
146 bindvars = {
"period" : period }
148 project =
'data%02i%%' % (year-2000)
149 condition += [
"PR.P_PROJECT like :proj" ]
150 bindvars[
"proj"] = project
151 result = cls.query(output, condition, bindvars)
155 for record
in result:
158 if run
not in tmpstore:
160 tmpstore[run] += [info]
162 cls.__store.update(tmpstore)
164 return sorted( [r[0]
for r
in result] )
◆ getUsedTables()
def python.AtlRunQueryCOMA.ARQ_COMA.getUsedTables |
( |
|
cls, |
|
|
|
output, |
|
|
|
condition |
|
) |
| |
Definition at line 29 of file AtlRunQueryCOMA.py.
30 usedtables =
set( [o.split(
'.')[0]
for o
in output] )
34 if '.' in p
and '\'' not in p:
35 usedtables.add(p.split(
'.')[0].lstrip(
'('))
37 return [
"%s.%s %s" % (cls.__schema,cls.__tables[t],t)
for t
in usedtables]
◆ query()
def python.AtlRunQueryCOMA.ARQ_COMA.query |
( |
|
cls, |
|
|
|
output, |
|
|
|
condition, |
|
|
|
bindvars, |
|
|
|
verbose = False |
|
) |
| |
Definition at line 41 of file AtlRunQueryCOMA.py.
41 def query(cls, output, condition, bindvars, verbose=False):
42 query =
'select distinct %s from %s' % (
', '.
join(output),
43 ', '.
join(cls.getUsedTables(output, condition)))
45 query +=
' where ' +
' and '.
join(condition)
47 print (
"="*80,
"\n",query)
49 c.execute(
str(query),bindvars)
◆ __cursor
python.AtlRunQueryCOMA.ARQ_COMA.__cursor = None |
|
staticprivate |
◆ __schema
string python.AtlRunQueryCOMA.ARQ_COMA.__schema = "ATLAS_TAGS_METADATA" |
|
staticprivate |
◆ __store
dictionary python.AtlRunQueryCOMA.ARQ_COMA.__store = {} |
|
staticprivate |
◆ __tables
dictionary python.AtlRunQueryCOMA.ARQ_COMA.__tables |
|
staticprivate |
◆ all_periods
python.AtlRunQueryCOMA.ARQ_COMA.all_periods = None |
|
static |
The documentation for this class was generated from the following file:
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.