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

Classes

class  Defect

Functions

 build_table (**kwargs)
 build_defects (descriptions, virtuals, intolerables, lbs, lumis, all_defects)
 copy_art (target_dir)
 main ()

Variables

 verbose
 ip
str GRAPH_URL = "http://atlasdqm.web.cern.ch/atlasdqm/defect_graph/HEAD"
list headings
 Headings control the content which is displayed.
 heading_names
 heading_titles
str content_string

Function Documentation

◆ build_defects()

dq_defect_info_table.build_defects ( descriptions,
virtuals,
intolerables,
lbs,
lumis,
all_defects )

Definition at line 122 of file dq_defect_info_table.py.

122def build_defects(descriptions, virtuals, intolerables, lbs, lumis, all_defects):
123
124 with timer("Sort defects by channel"):
125 dbc = all_defects.by_channel
126
127 with timer("Compute luminosities"):
128 lumi_by_defect = compute_lumi_many_channels(lbs, lumis, all_defects)
129
130 defects = []
131
132 for name, description in sorted(descriptions.iteritems()):
133 virtual, intolerable = name in virtuals, name in intolerables
134 defect = Defect(name, description, dbc[name], virtual, intolerable,
135 lumi_by_defect.get(name, 0))
136 defects.append(defect)
137
138 defects.sort(key=lambda d: (d.virtual, not d.intolerable))
139
140 return defects
141

◆ build_table()

dq_defect_info_table.build_table ( ** kwargs)
Build the HTML content

Definition at line 109 of file dq_defect_info_table.py.

109def build_table(**kwargs):
110 """
111 Build the HTML content
112 """
113 path = resource_filename("DQDefects.data", "table.html")
114 with open(path) as fd:
115 template = MarkupTemplate(fd, path)
116
117 stream = template.generate(HTML=HTML, **kwargs)
118 serializer = HTMLSerializer(doctype="html5")
119 content = encode(serializer(stream))
120 return content
121

◆ copy_art()

dq_defect_info_table.copy_art ( target_dir)

Definition at line 142 of file dq_defect_info_table.py.

142def copy_art(target_dir):
143 art_base = dirname(resource_filename("DQDefects.data", "table.html"))
144
145 for filename in listdir(art_base):
146 _, _, ext = filename.rpartition(".")
147 if ext.lower() not in ("png", "js", "css"):
148 continue
149 copy2(pjoin(art_base, filename), pjoin(target_dir, filename))
150
std::string dirname(std::string name)
Definition utils.cxx:200

◆ main()

dq_defect_info_table.main ( )

Definition at line 151 of file dq_defect_info_table.py.

151def main():
152 d = DefectsDB()
153
154 iov_range = None, None #
155 iov_range = 185000 << 32, 185500 << 32
156 #iov_range = 177682 << 32, 200000 << 32
157
158 with timer("Fetch defect info"):
159 all_defects = d.retrieve(*iov_range)
160
161 with timer("fetch peripheral information"):
162 descriptions = d.all_defect_descriptions
163 intolerable = d.get_intolerable_defects()
164 virtual = d.virtual_defect_names
165
166 with timer("Fetch lumi inputs"):
167 lbs, lumis = fetch_lumi_inputs(iov_range, "ONLINE")
168
169 d = build_defects(descriptions, virtual, intolerable, lbs, lumis, all_defects)
170
171 target_dir = "/afs/cern.ch/user/p/pwaller/www/defects/test"
172 art_dir = pjoin(target_dir, "extern")
173
174 if not exists(art_dir):
175 makedirs(art_dir)
176
177 copy_art(art_dir)
178
179 content = build_table(headings=heading_titles, defects=d)
180 with open(pjoin(target_dir, "test.html"), "w") as fd:
181 fd.write(content)
182
183
bool exists(const std::string &filename)
does a file exist
int main()
Definition hello.cxx:18

Variable Documentation

◆ content_string

str dq_defect_info_table.content_string
Initial value:
1= "".join("<td>{{d.{0}}}</td>".format(x)
2 for x in heading_names if x)

Definition at line 45 of file dq_defect_info_table.py.

◆ GRAPH_URL

str dq_defect_info_table.GRAPH_URL = "http://atlasdqm.web.cern.ch/atlasdqm/defect_graph/HEAD"

Definition at line 23 of file dq_defect_info_table.py.

◆ heading_names

dq_defect_info_table.heading_names

Definition at line 43 of file dq_defect_info_table.py.

◆ heading_titles

dq_defect_info_table.heading_titles

Definition at line 43 of file dq_defect_info_table.py.

◆ headings

list dq_defect_info_table.headings
Initial value:
1= [
2 ("", "V"),
3 ("", "T"),
4 ("", "U"),
5 ("", "B"),
6 ("name_with_url", "Name"),
7 ("description", "Description"),
8 ("nruns", "# Runs"),
9 ("latest_run", "Latest Run"),
10 ("rec_lb_frac", "Potentially Recoverable LB %"),
11 ("lumi", HTML("Luminosity (pb<sup>-1</sup>)")),
12 #("nlumi", "nlumi"),
13 #("nlumi_rec", "nlumi"),
14]

Headings control the content which is displayed.

(Defect.name, "Heading description") Blank identifier means it is constructed entirely inside Defect.content

Definition at line 28 of file dq_defect_info_table.py.

◆ ip

dq_defect_info_table.ip

Definition at line 21 of file dq_defect_info_table.py.

◆ verbose

dq_defect_info_table.verbose

Definition at line 16 of file dq_defect_info_table.py.