Definition at line 16 of file AtlRunQueryAMI.py.
◆ amiclient()
def python.AtlRunQueryAMI.ARQ_AMI.amiclient |
( |
|
cls | ) |
|
Definition at line 82 of file AtlRunQueryAMI.py.
83 if cls._amiclient
is None:
85 from CoolRunQuery.utils.AtlRunQueryUtils
import runsOnServer
87 home =
"/data/atrqadm/data/"
92 conffilename = home +
"/private/AMIConf.txt"
93 cls._amiclient = cls.getAmiClient(conffilename)
94 if cls._amiclient
is None:
95 print (
"ERROR: voms-proxy authentication not valid and no AMI configuration file",conffilename,
"supplied. No access to AMI!")
96 cls._amiclient=
"No AMI"
◆ amiexec()
def python.AtlRunQueryAMI.ARQ_AMI.amiexec |
( |
|
cls, |
|
|
|
cmdList |
|
) |
| |
Definition at line 112 of file AtlRunQueryAMI.py.
112 def amiexec(cls, cmdList):
114 result = cls.amiclient().
execute(cmdList)
115 return result.getDict()
116 except Exception
as ex:
117 print (
"AMI exception '",
type(ex),
"' occured")
119 traceback.print_exc()
◆ get_all_periods()
def python.AtlRunQueryAMI.ARQ_AMI.get_all_periods |
( |
|
cls | ) |
|
Definition at line 162 of file AtlRunQueryAMI.py.
162 def get_all_periods(cls):
163 if cls.all_periods
is not None:
164 return cls.all_periods
166 p = re.compile(
r"(?P<period>(?P<periodletter>[A-Za-z]+)(?P<periodnumber>\d+)?)$")
168 result = cls.get_periods(0, 0)
169 for period, projectName
in result:
173 year =
int(projectName[4:6])
174 period_letter = m.group(
'periodletter')
175 period_number =
int(m.group(
'periodnumber'))
if m.group(
'periodnumber')
else 0
176 if len(period_letter)!=1:
179 pc = 10000*year + 100*(ord(period_letter.upper())-65) + period_number
180 cls.all_periods += [ ((year, period, pc), projectName+
".period" + period) ]
181 cls.all_periods.sort()
184 traceback.print_exc()
186 return cls.all_periods
◆ get_periods()
def python.AtlRunQueryAMI.ARQ_AMI.get_periods |
( |
|
cls, |
|
|
|
year, |
|
|
|
level |
|
) |
| |
Definition at line 143 of file AtlRunQueryAMI.py.
143 def get_periods(cls, year, level):
145 cmd = [
'ListDataPeriods',
'-createdSince=2009-01-01 00:00:00' ]
147 cmd += [
'-projectName=data%02i%%' % (year-2000) ]
149 cmd += [
'-periodLevel=%i' % level ]
151 result = cls.amiexec(cmd)
153 rows = [ (e[
'period'], e[
'projectName'])
for e
in result[
'Element_Info'].
values() ]
◆ get_periods_for_run()
def python.AtlRunQueryAMI.ARQ_AMI.get_periods_for_run |
( |
|
cls, |
|
|
|
run |
|
) |
| |
Definition at line 124 of file AtlRunQueryAMI.py.
124 def get_periods_for_run(cls, run):
129 if run
not in cls.store:
131 print (
'GetDataPeriodsForRun',
'-runNumber=%i' % run)
133 result = cls.amiexec([
'GetDataPeriodsForRun',
'-runNumber=%i' % run])
135 cls.store[run] =
sorted([ (
int(e[
'periodLevel']),e[
'period'],e[
'project'])
for e
in result[
'Element_Info'].
values() ])
139 return [x[1]
for x
in cls.store[run]]
◆ get_runs()
def python.AtlRunQueryAMI.ARQ_AMI.get_runs |
( |
|
cls, |
|
|
|
period, |
|
|
|
year |
|
) |
| |
Definition at line 190 of file AtlRunQueryAMI.py.
192 cmd = [
'GetRunsForDataPeriod',
'-period=%s' % period]
194 cmd += [
'-projectName=data%02i%%' % (year-2000) ]
196 result = cls.amiexec(cmd)
199 r =
sorted([
int(e[
'runNumber'])
for e
in result[
'Element_Info'].
values() ])
201 except (ValueError, KeyError):
◆ getAmiClient()
def python.AtlRunQueryAMI.ARQ_AMI.getAmiClient |
( |
|
cls, |
|
|
|
amiconf = None , |
|
|
|
verbose = False |
|
) |
| |
get ami client
param amiconf: name of file with AMI user and pw
If a valid filename is specified, it tries to read the
username and password from there. If that does not succeed or
no filename is specified, voms based authentication is tried.
Definition at line 24 of file AtlRunQueryAMI.py.
24 def getAmiClient(cls, amiconf = None, verbose = False):
26 param amiconf: name of file with AMI user and pw
28 If a valid filename is specified, it tries to read the
29 username and password from there. If that does not succeed or
30 no filename is specified, voms based authentication is tried.
32 from pyAMI.pyAMI
import AMI,pyAMIEndPoint
33 from os
import stat,path
37 if not path.exists(amiconf):
39 print (
"WARNING: AMI config file", amiconf,
"does not exist. Need to rely on valid voms proxy.")
40 elif stat(amiconf).st_mode & path.stat.S_IRUSR == 0:
42 print (
"WARNING: AMI config file", amiconf,
"exists but is not readable. Need to rely on valid voms proxy.")
47 pyAMIEndPoint.setType(
"replica")
49 ami.readConfig(amiconf)
51 print (
"... connecting to CERN AMI replica with user+pw")
53 pyAMIEndPoint.setType(
"main")
56 print (
"... connecting to AMI main server with user+pw")
59 print (
"WARNING: Authentication in config file",amiconf,
"not valid, check format, user, pw. Need to rely on valid voms proxy.")
62 pyAMIEndPoint.setType(
"replica")
65 print (
"... connecting to CERN replica using voms-proxy")
69 pyAMIEndPoint.setType(
"main")
72 print (
"... connecting to main server using voms-proxy")
77 print (
"WARNING voms-proxy authentication not valid. No access to AMI.")
◆ OpenAMIConnection()
def python.AtlRunQueryAMI.ARQ_AMI.OpenAMIConnection |
( |
|
cls | ) |
|
Definition at line 100 of file AtlRunQueryAMI.py.
100 def OpenAMIConnection(cls):
102 from pyAMI.pyAMI
import AMI
104 amiclient.readConfig(
"./AMIConf.txt")
107 print (
'ERROR: could not load pyAMI')
◆ _amiclient
python.AtlRunQueryAMI.ARQ_AMI._amiclient = None |
|
staticprivate |
◆ all_periods
python.AtlRunQueryAMI.ARQ_AMI.all_periods = None |
|
static |
◆ store
dictionary python.AtlRunQueryAMI.ARQ_AMI.store = {} |
|
static |
The documentation for this class was generated from the following file: