test_ViewBokeh.py
Go to the documentation of this file.
1 # Test functions for the ViewBokeh
2 print "test : --- Testing ViewBokeh"
3 import Tier, Chain, Metric, ViewBokeh, ParserArtEvents
4 import cPickle
5 ###########################
6 # Show metric
7 print "\ntest : --- singlePlot"
8 pkl_file = "output/FD_data_cosmics_raw2root_.pkl"
9 chain = cPickle.load(open(pkl_file, "rb"))
10 tier = chain.GetTier("pchits")
11 metric = tier.metric
12 metric.refresh()
13 art_events = ParserArtEvents.parseLines(tier.log)
14 events = art_events.events
15 queries = art_events.queries
16 parsing = art_events.parsing
17 
18 #ViewBokeh.drawSingleMetric("pchits.html",metric,"memory_percent",
19  #title="PC hits memory usage example",
20  #x_axis_label="Time [s]",
21  #y_axis_label="Memory usage [%]",
22  #events=[events,queries,parsing],
23  #events_legend=["Events","DB queries","DB parsing"])
24 print "test : ---"
25 ###########################
26 # Show tier metrics
27 print "\ntest : --- tier Plot"
28 pkl_file = "output/FD_data_cosmics_raw2root_.pkl"
29 chain = cPickle.load(open(pkl_file, "rb"))
30 tier = chain.GetTier("pchits")
31 attributes = ["memory",
32  "memory_percent",
33  "cpu_percent",
34  "read_bytes",
35  "write_bytes",
36  "u_cpu_times",
37  "s_cpu_times",
38  "rss_memory",
39  "vms_memory",
40  "n_open_files",
41  "n_connections",
42 ]
43 #ViewBokeh.drawTier("tier.html", tier, attributes)
44 print "test : ---"
45 ###########################
46 # Show metrics
47 print "\ntest : --- multi Plot"
48 pkl_file = "output/FD_data_cosmics_raw2root_.pkl"
49 chain = cPickle.load(open(pkl_file, "rb"))
50 attributes = ["memory",
51  "memory_percent",
52  "cpu_percent",
53  "read_bytes",
54  "write_bytes",
55  "u_cpu_times",
56  "s_cpu_times",
57  "rss_memory",
58  "vms_memory",
59  "n_open_files",
60  "n_connections",
61 ]
62 #ViewBokeh.drawChain("chain.html", chain, attributes)
63 print "test : ---"
64 ###########################
65 # tier to HTML
66 print "\ntest : --- tier to HTML"
67 pkl_file = "output/FD_data_cosmics_raw2root_.pkl"
68 chain = cPickle.load(open(pkl_file, "rb"))
69 tier = chain.GetTier("pchits")
70 attributes = ["memory",
71  "memory_percent",
72  "cpu_percent",
73  "read_bytes",
74  "write_bytes",
75  "u_cpu_times",
76  "s_cpu_times",
77  "rss_memory",
78  "vms_memory",
79  "n_open_files",
80  "n_connections",
81 ]
82 html = ViewBokeh.tierToHTML(tier, attributes)
83 print html
84 js_list = ViewBokeh.findJSList(html)
85 print js_list
86 print "test : ---"
def tierToHTML(tier, attributes, title="", bokeh_path="/Users/mt354/anaconda/lib/python2.7/site-packages/bokeh/server/static/", base_url="/Users/mt354/Analysis/Production/", verbose=False)
draw all metrics from a tier
Definition: ViewBokeh.py:232
def findJSList(html)
Find all the embeded js objects in a html file.
Definition: ViewBokeh.py:431
procfile open("FD_BRL_v0.txt")
def parseLines(lines, verbose=False)
Parse output file.