|
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 17 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 55 of file AtlRunQueryCOMA.py.
56 """get COMA connection
57 any connection to ATLR is fine, we use Trigger DB
61 from CoolRunQuery.utils.AtlRunQueryTriggerUtils
import interpretConnection
64 from cx_Oracle
import connect
65 connection = connect ( connectionParameters[
"user"],
66 connectionParameters[
"passwd"],
67 connectionParameters[
"server"], threaded=
True)
68 cls.__cursor = connection.cursor()
◆ get_all_periods()
def python.AtlRunQueryCOMA.ARQ_COMA.get_all_periods |
( |
|
cls | ) |
|
Definition at line 111 of file AtlRunQueryCOMA.py.
111 def get_all_periods(cls):
112 if cls.all_periods
is not None:
113 return cls.all_periods
115 p = re.compile(
r"(?P<periodletter>[A-Za-z]+)(?P<periodnumber>\d+)?$")
117 result = cls.get_periods(0, 0)
118 for period, projectName
in result:
119 year =
int(projectName[4:6])
122 print (
"Period '%s'does not match pattern [A-Za-z]+\\d+" % period)
125 period_letter = m.group(
'periodletter')
126 period_number =
int(m.group(
'periodnumber'))
if m.group(
'periodnumber')
else 0
127 if len(period_letter)!=1:
130 pc = 10000*year + 100*(ord(period_letter.upper())-65) + period_number
132 cls.all_periods += [ ((year, period, pc, projectName), projectName+
".period" + period) ]
134 cls.all_periods.sort()
137 traceback.print_exc()
139 return cls.all_periods
◆ get_periods()
def python.AtlRunQueryCOMA.ARQ_COMA.get_periods |
( |
|
cls, |
|
|
|
year = 0 , |
|
|
|
level = 0 |
|
) |
| |
Definition at line 93 of file AtlRunQueryCOMA.py.
93 def get_periods(cls, year=0, level=0):
94 output = [
'PR.P_PERIOD',
'PR.P_PROJECT' ]
99 condition += [
"PR.P_LEVEL=:lvl" ]
100 bindvars[
"lvl"] = level
103 project =
'data%02i%%' % (year-2000)
104 condition += [
"PR.P_PROJECT like :proj" ]
105 bindvars[
"proj"] = project
107 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 77 of file AtlRunQueryCOMA.py.
77 def get_periods_for_run(cls, run):
82 if run
not in cls.__store:
83 output = [
'PR.P_LEVEL',
'PR.P_PERIOD',
'PR.P_PROJECT' ]
84 condition = [
"PR.RUN_INDEX = :run" ]
85 bindvars = {
"run": run }
87 cls.__store[run] =
sorted( cls.query(output, condition, bindvars) )
89 return [x[1]
for x
in cls.__store[run]]
◆ get_runs()
def python.AtlRunQueryCOMA.ARQ_COMA.get_runs |
( |
|
cls, |
|
|
|
period, |
|
|
|
year |
|
) |
| |
Definition at line 143 of file AtlRunQueryCOMA.py.
144 output = [
'PR.RUN_INDEX',
'PR.P_LEVEL',
'PR.P_PERIOD',
'PR.P_PROJECT' ]
146 condition = [
"PR.P_PERIOD=:period" ]
147 bindvars = {
"period" : period }
149 project =
'data%02i%%' % (year-2000)
150 condition += [
"PR.P_PROJECT like :proj" ]
151 bindvars[
"proj"] = project
152 result = cls.query(output, condition, bindvars)
156 for record
in result:
159 if run
not in tmpstore:
161 tmpstore[run] += [info]
163 cls.__store.
update(tmpstore)
165 return sorted( [r[0]
for r
in result] )
◆ getUsedTables()
def python.AtlRunQueryCOMA.ARQ_COMA.getUsedTables |
( |
|
cls, |
|
|
|
output, |
|
|
|
condition |
|
) |
| |
Definition at line 30 of file AtlRunQueryCOMA.py.
31 usedtables =
set( [o.split(
'.')[0]
for o
in output] )
35 if '.' in p
and '\'' not in p:
36 usedtables.add(p.split(
'.')[0].lstrip(
'('))
38 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 42 of file AtlRunQueryCOMA.py.
42 def query(cls, output, condition, bindvars, verbose=False):
43 query =
'select distinct %s from %s' % (
', '.
join(output),
44 ', '.
join(cls.getUsedTables(output, condition)))
46 query +=
' where ' +
' and '.
join(condition)
48 print (
"="*80,
"\n",query)
50 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.