ATLAS Offline Software
Loading...
Searching...
No Matches
athena_checkUpload Namespace Reference

Functions

 StartDate (period)
 --> Definitions:
 ConvertedRunNumber (rNumber)
 RunListInDBTotal (start_date, end_date, file_name, string_pattern)
 channelValueQuery (server, schema, dbname, folder, iov0, iov1, tag, channels)
 RunListInDB (array, server, schema, dbname, folder, tag, channels)
 GetNumberOfNoisyModulesInDB (array, server, schema, dbname, folder, tag, channels)
 GetNumberOfNoisyStripsInDB (array, server, schema, dbname, folder, tag, channels)
 GetNoisyModulesAverageInDB (array)
 DisplayInfoForRunsInDB (runs, noisy_mods, noisy_strips)

Variables

int Period = 7
 --> Execution phase:
 startDate = StartDate(Period)
 endDate = str(datetime.date.today())
str fileName = "./runs_"+startDate+"_"+endDate+".txt"
str Server = 'ATLAS_COOLPROD'
str Schema = 'ATLAS_COOLOFL_SCT'
str Dbname = 'COMP200'
str Folder = '/SCT/Derived/Monitoring'
str Tag = 'SctDerivedMonitoring-003-00'
str String_Pattern = 'ATLAS'
 RunsInDBTotal = RunListInDBTotal(startDate, endDate, fileName, String_Pattern)
 RunsInDB = RunListInDB(RunsInDBTotal, Server,Schema,Dbname,Folder,Tag,'*')
 numNoisyModulesInDB = GetNumberOfNoisyModulesInDB(RunsInDB, Server,Schema,Dbname,Folder,Tag,'*')
 noisyModulesAverageInDB = GetNoisyModulesAverageInDB(numNoisyModulesInDB)
 noisyStripsInDB = GetNumberOfNoisyStripsInDB(RunsInDB, Server,Schema,Dbname,Folder,Tag,'*')
 noisyStripsInDB_lastRun = noisyStripsInDB[0]

Function Documentation

◆ channelValueQuery()

athena_checkUpload.channelValueQuery ( server,
schema,
dbname,
folder,
iov0,
iov1,
tag,
channels )

Definition at line 64 of file athena_checkUpload.py.

64def channelValueQuery(server, schema, dbname, folder, iov0, iov1, tag, channels):
65 timespan= str(iov0) + '-' + str(iov1)
66 prefix='http://coolcherrypy.cern.ch:8080/cooldb/'
67 d = '/'
68 url = prefix+server+d+schema+d+dbname+folder+'/timespan/'+timespan+'/tag/'+tag+'/channels/'+channels
69 httpHeaders={'Accept':'text/xml'}
70 textData=None
71 #print(url)
72 request=urllib2.Request(url,textData, httpHeaders)
73 u=urllib2.urlopen(request)
74 xmlDocString = u.read()
75 return xmlDocString
76

◆ ConvertedRunNumber()

athena_checkUpload.ConvertedRunNumber ( rNumber)

Definition at line 23 of file athena_checkUpload.py.

23def ConvertedRunNumber(rNumber):
24 RNumber = long(rNumber)
25 return RNumber << 32
26

◆ DisplayInfoForRunsInDB()

athena_checkUpload.DisplayInfoForRunsInDB ( runs,
noisy_mods,
noisy_strips )

Definition at line 168 of file athena_checkUpload.py.

168def DisplayInfoForRunsInDB(runs, noisy_mods, noisy_strips):
169 if (len(runs) != 0):
170 for i in range(len(runs)):
171 print("Run: ",runs[i], " --> Num. noisy modules: ", noisy_mods[i], " --> Num. noisy channels: ", noisy_strips[i])
172 else:
173 print("--> No information found.")
174
void print(char *figname, TCanvas *c1)

◆ GetNoisyModulesAverageInDB()

athena_checkUpload.GetNoisyModulesAverageInDB ( array)

Definition at line 157 of file athena_checkUpload.py.

157def GetNoisyModulesAverageInDB(array):
158 sum=0
159 if (len(array) != 0):
160 for j in range(len(array)):
161 sum=sum+array[j]
162 NoisyModulesAverage = sum/len(array)
163 else:
164 NoisyModulesAverage = -999
165 return NoisyModulesAverage
166

◆ GetNumberOfNoisyModulesInDB()

athena_checkUpload.GetNumberOfNoisyModulesInDB ( array,
server,
schema,
dbname,
folder,
tag,
channels )

Definition at line 100 of file athena_checkUpload.py.

100def GetNumberOfNoisyModulesInDB(array, server, schema, dbname, folder, tag, channels):
101 Array_numNoisyModules=[]
102 if (array[0] != -999):
103 for i in range(len(array)):
104 runNumber=array[i]
105 iovSince=ConvertedRunNumber(runNumber)
106 iovUntil=ConvertedRunNumber(runNumber+1)-1
107
108 derived_string=channelValueQuery(server, schema, dbname, folder, iovSince, iovUntil, tag, channels)
109
110 derived=NonvalidatingReader.parseString(derived_string,uri="dummy")
111 numNoisyModules=derived.xpath(u'count(//channel)')
112 if numNoisyModules !=0.0:
113 Array_numNoisyModules.append(numNoisyModules)
114 else:
115 Array_numNoisyModules.append(-999)
116
117 return Array_numNoisyModules
118

◆ GetNumberOfNoisyStripsInDB()

athena_checkUpload.GetNumberOfNoisyStripsInDB ( array,
server,
schema,
dbname,
folder,
tag,
channels )

Definition at line 120 of file athena_checkUpload.py.

120def GetNumberOfNoisyStripsInDB(array, server, schema, dbname, folder, tag, channels):
121 Array_numNoisyStrips = []
122 if (array[0] != -999):
123 for i in range(len(array)):
124 runNumber=array[i]
125 iovSince=ConvertedRunNumber(runNumber)
126 iovUntil=ConvertedRunNumber(runNumber+1)-1
127
128 derived_string=channelValueQuery(server, schema, dbname, folder, iovSince, iovUntil, tag, channels)
129
130 derived=NonvalidatingReader.parseString(derived_string,uri="dummy")
131 numNoisyModules=derived.xpath(u'count(//channel)')
132 if numNoisyModules !=0.0:
133
134 allDefectStripsList=(derived.xpath(u"//channel/value[@name='DefectList']"))
135 numNoisyStrips=0
136 numNoisyStripsAdds=0
137
138 for strips in allDefectStripsList:
139 words=strips.firstChild.data.split()
140 for j in range(len(words)):
141 jk=words[j]
142 if jk.find("-")>=0:
143 sep=jk.replace ( '-', ' ' )
144 sep1=sep.split()
145 numNoisyStripsAdds=numNoisyStripsAdds+int(sep1[1])-int(sep1[0])
146
147 numNoisyStrips=numNoisyStrips+len(strips.firstChild.data.split())
148
149 Array_numNoisyStrips.append(numNoisyStrips + numNoisyStripsAdds)
150
151 else:
152 Array_numNoisyStrips.append(-999)
153
154 return Array_numNoisyStrips
155

◆ RunListInDB()

athena_checkUpload.RunListInDB ( array,
server,
schema,
dbname,
folder,
tag,
channels )

Definition at line 78 of file athena_checkUpload.py.

78def RunListInDB(array, server, schema, dbname, folder, tag, channels):
79 Array_runsInDB=[]
80 if (len(array) != 0):
81 for i in range(len(array)):
82 runNumber=array[i]
83 iovSince=ConvertedRunNumber(runNumber)
84 iovUntil=ConvertedRunNumber(runNumber+1)-1
85
86 derived_string=channelValueQuery(server, schema, dbname, folder, iovSince, iovUntil, tag, channels)
87
88 derived=NonvalidatingReader.parseString(derived_string,uri="dummy")
89 numNoisyModules=derived.xpath(u'count(//channel)')
90
91 if numNoisyModules !=0.0:
92 Array_runsInDB.append(runNumber)
93 else:
94 Array_runsInDB.append(-999)
95
96 return Array_runsInDB
97
98

◆ RunListInDBTotal()

athena_checkUpload.RunListInDBTotal ( start_date,
end_date,
file_name,
string_pattern )

Definition at line 28 of file athena_checkUpload.py.

28def RunListInDBTotal(start_date, end_date, file_name, string_pattern):
29 prefix="http://atlas-service-runinformation.web.cern.ch/atlas-service-runinformation/cgi-bin/runnumbers.py?"
30 url=prefix+"start.date="+start_date+"%2012:06:00&end.date="+end_date+"%2012:06:00&format=html"
31 # print(url)
32 request=urllib2.Request(url)
33 u=urllib2.urlopen(request)
34 DocString = u.read()
35
36 DocString_1 = DocString.replace ( '<td>', ' ' )
37 DocString_2 = DocString_1.replace ( '</td>', ' ' )
38 DocString_3 = DocString_2.replace ( '<tr>', ' ' )
39 DocString_4 = DocString_3.replace ( '</tr>', ' ' )
40 DocString_5 = DocString_4.replace ( '<th>Name</th><th>Number</th><th>Start At (UTC)</th><th>Duration</th><th>Partition</th>', ' ' )
41
42
43 f=open(file_name, 'w')
44 f.write(DocString_5)
45 f.close()
46
47 Runs = []
48 if os.path.exists(file_name):
49 f = open(file_name,'r')
50 for line in f.readlines():
51 if line.find(string_pattern)>= 0:
52 ar=string.split(line)
53 Runs.append(int(ar[1]))
54 f.close()
55 else:
56 print("-->ERROR: athena_checkUpload: Can't find input file !")
57
58
59 os.remove(file_name)
60
61 return Runs
62

◆ StartDate()

athena_checkUpload.StartDate ( period)

--> Definitions:

Definition at line 17 of file athena_checkUpload.py.

17def StartDate(period):
18
19 start_date = (datetime.date.today() - datetime.timedelta(period)).isoformat()
20 return start_date
21

Variable Documentation

◆ Dbname

str athena_checkUpload.Dbname = 'COMP200'

Definition at line 187 of file athena_checkUpload.py.

◆ endDate

athena_checkUpload.endDate = str(datetime.date.today())

Definition at line 181 of file athena_checkUpload.py.

◆ fileName

str athena_checkUpload.fileName = "./runs_"+startDate+"_"+endDate+".txt"

Definition at line 183 of file athena_checkUpload.py.

◆ Folder

str athena_checkUpload.Folder = '/SCT/Derived/Monitoring'

Definition at line 188 of file athena_checkUpload.py.

◆ noisyModulesAverageInDB

athena_checkUpload.noisyModulesAverageInDB = GetNoisyModulesAverageInDB(numNoisyModulesInDB)

Definition at line 197 of file athena_checkUpload.py.

◆ noisyStripsInDB

athena_checkUpload.noisyStripsInDB = GetNumberOfNoisyStripsInDB(RunsInDB, Server,Schema,Dbname,Folder,Tag,'*')

Definition at line 199 of file athena_checkUpload.py.

◆ noisyStripsInDB_lastRun

athena_checkUpload.noisyStripsInDB_lastRun = noisyStripsInDB[0]

Definition at line 200 of file athena_checkUpload.py.

◆ numNoisyModulesInDB

athena_checkUpload.numNoisyModulesInDB = GetNumberOfNoisyModulesInDB(RunsInDB, Server,Schema,Dbname,Folder,Tag,'*')

Definition at line 196 of file athena_checkUpload.py.

◆ Period

int athena_checkUpload.Period = 7

--> Execution phase:

Definition at line 179 of file athena_checkUpload.py.

◆ RunsInDB

athena_checkUpload.RunsInDB = RunListInDB(RunsInDBTotal, Server,Schema,Dbname,Folder,Tag,'*')

Definition at line 194 of file athena_checkUpload.py.

◆ RunsInDBTotal

athena_checkUpload.RunsInDBTotal = RunListInDBTotal(startDate, endDate, fileName, String_Pattern)

Definition at line 193 of file athena_checkUpload.py.

◆ Schema

str athena_checkUpload.Schema = 'ATLAS_COOLOFL_SCT'

Definition at line 186 of file athena_checkUpload.py.

◆ Server

str athena_checkUpload.Server = 'ATLAS_COOLPROD'

Definition at line 185 of file athena_checkUpload.py.

◆ startDate

athena_checkUpload.startDate = StartDate(Period)

Definition at line 180 of file athena_checkUpload.py.

◆ String_Pattern

str athena_checkUpload.String_Pattern = 'ATLAS'

Definition at line 190 of file athena_checkUpload.py.

◆ Tag

str athena_checkUpload.Tag = 'SctDerivedMonitoring-003-00'

Definition at line 189 of file athena_checkUpload.py.