Definition at line 17 of file AtlRunQueryAMI.py.
◆ amiclient()
def python.AtlRunQueryAMI.ARQ_AMI.amiclient |
( |
|
cls | ) |
|
Definition at line 83 of file AtlRunQueryAMI.py.
84 if cls._amiclient
is None:
86 from CoolRunQuery.utils.AtlRunQueryUtils
import runsOnServer
88 home =
"/data/atrqadm/data/"
93 conffilename = home +
"/private/AMIConf.txt"
94 cls._amiclient = cls.getAmiClient(conffilename)
95 if cls._amiclient
is None:
96 print (
"ERROR: voms-proxy authentication not valid and no AMI configuration file",conffilename,
"supplied. No access to AMI!")
97 cls._amiclient=
"No AMI"
◆ amiexec()
def python.AtlRunQueryAMI.ARQ_AMI.amiexec |
( |
|
cls, |
|
|
|
cmdList |
|
) |
| |
Definition at line 113 of file AtlRunQueryAMI.py.
113 def amiexec(cls, cmdList):
115 result = cls.amiclient().
execute(cmdList)
116 return result.getDict()
117 except Exception
as ex:
118 print (
"AMI exception '",
type(ex),
"' occured")
120 traceback.print_exc()
◆ get_all_periods()
def python.AtlRunQueryAMI.ARQ_AMI.get_all_periods |
( |
|
cls | ) |
|
Definition at line 163 of file AtlRunQueryAMI.py.
163 def get_all_periods(cls):
164 if cls.all_periods
is not None:
165 return cls.all_periods
167 p = re.compile(
r"(?P<period>(?P<periodletter>[A-Za-z]+)(?P<periodnumber>\d+)?)$")
169 result = cls.get_periods(0, 0)
170 for period, projectName
in result:
174 year =
int(projectName[4:6])
175 period_letter = m.group(
'periodletter')
176 period_number =
int(m.group(
'periodnumber'))
if m.group(
'periodnumber')
else 0
177 if len(period_letter)!=1:
180 pc = 10000*year + 100*(ord(period_letter.upper())-65) + period_number
181 cls.all_periods += [ ((year, period, pc), projectName+
".period" + period) ]
182 cls.all_periods.sort()
185 traceback.print_exc()
187 return cls.all_periods
◆ get_periods()
def python.AtlRunQueryAMI.ARQ_AMI.get_periods |
( |
|
cls, |
|
|
|
year, |
|
|
|
level |
|
) |
| |
Definition at line 144 of file AtlRunQueryAMI.py.
144 def get_periods(cls, year, level):
146 cmd = [
'ListDataPeriods',
'-createdSince=2009-01-01 00:00:00' ]
148 cmd += [
'-projectName=data%02i%%' % (year-2000) ]
150 cmd += [
'-periodLevel=%i' % level ]
152 result = cls.amiexec(cmd)
154 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 125 of file AtlRunQueryAMI.py.
125 def get_periods_for_run(cls, run):
130 if run
not in cls.store:
132 print (
'GetDataPeriodsForRun',
'-runNumber=%i' % run)
134 result = cls.amiexec([
'GetDataPeriodsForRun',
'-runNumber=%i' % run])
136 cls.store[run] =
sorted([ (
int(e[
'periodLevel']),e[
'period'],e[
'project'])
for e
in result[
'Element_Info'].
values() ])
140 return [x[1]
for x
in cls.store[run]]
◆ get_runs()
def python.AtlRunQueryAMI.ARQ_AMI.get_runs |
( |
|
cls, |
|
|
|
period, |
|
|
|
year |
|
) |
| |
Definition at line 191 of file AtlRunQueryAMI.py.
193 cmd = [
'GetRunsForDataPeriod',
'-period=%s' % period]
195 cmd += [
'-projectName=data%02i%%' % (year-2000) ]
197 result = cls.amiexec(cmd)
200 r =
sorted([
int(e[
'runNumber'])
for e
in result[
'Element_Info'].
values() ])
202 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 25 of file AtlRunQueryAMI.py.
25 def getAmiClient(cls, amiconf = None, verbose = False):
27 param amiconf: name of file with AMI user and pw
29 If a valid filename is specified, it tries to read the
30 username and password from there. If that does not succeed or
31 no filename is specified, voms based authentication is tried.
33 from pyAMI.pyAMI
import AMI,pyAMIEndPoint
34 from os
import stat,path
38 if not path.exists(amiconf):
40 print (
"WARNING: AMI config file", amiconf,
"does not exist. Need to rely on valid voms proxy.")
41 elif stat(amiconf).st_mode & path.stat.S_IRUSR == 0:
43 print (
"WARNING: AMI config file", amiconf,
"exists but is not readable. Need to rely on valid voms proxy.")
48 pyAMIEndPoint.setType(
"replica")
50 ami.readConfig(amiconf)
52 print (
"... connecting to CERN AMI replica with user+pw")
54 pyAMIEndPoint.setType(
"main")
57 print (
"... connecting to AMI main server with user+pw")
60 print (
"WARNING: Authentication in config file",amiconf,
"not valid, check format, user, pw. Need to rely on valid voms proxy.")
63 pyAMIEndPoint.setType(
"replica")
66 print (
"... connecting to CERN replica using voms-proxy")
70 pyAMIEndPoint.setType(
"main")
73 print (
"... connecting to main server using voms-proxy")
78 print (
"WARNING voms-proxy authentication not valid. No access to AMI.")
◆ OpenAMIConnection()
def python.AtlRunQueryAMI.ARQ_AMI.OpenAMIConnection |
( |
|
cls | ) |
|
Definition at line 101 of file AtlRunQueryAMI.py.
101 def OpenAMIConnection(cls):
103 from pyAMI.pyAMI
import AMI
105 amiclient.readConfig(
"./AMIConf.txt")
108 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: