test_ViewGoogleCharts.py
Go to the documentation of this file.
1 # Test functions for the View Google Charts module
2 print "test : --- Testing the View Google Charts module"
3 import Tier
4 import Chain
5 import Projections
6 import ViewGoogleCharts
7 import glob
8 import cPickle
9 ###########################
10 # projection
11 print "test : --- Projection from Chain"
12 tier_projection = False
13 if tier_projection:
14  chain = Chain.Chain("chain")
15 
16  tier_a = Tier.Tier(short_name="tier_a")
17  tier_a.metric.input_events = 100
18  tier_a.metric.output_events = [99]
19  tier_a.metric.user_cpu = 100.
20  tier_a.metric.system_cpu = 14.
21  tier_a.dependencies = False
22  chain.AddTier(tier_a)
23 
24  tier_b = Tier.Tier(short_name="tier_b")
25  tier_b.metric.input_events = 100
26  tier_b.metric.output_events = [1]
27  tier_b.metric.user_cpu = 100.
28  tier_b.metric.system_cpu = 14.
29  tier_b.dependencies = False
30  chain.AddTier(tier_b)
31 
32  tier_c = Tier.Tier(short_name="tier_c")
33  tier_c.metric.input_events = 100
34  tier_c.metric.output_events = [99]
35  tier_c.metric.user_cpu = 100.
36  tier_c.metric.system_cpu = 14.
37  tier_c.dependencies = ['tier_a','tier_b']
38  chain.AddTier(tier_c)
39 
40  tier_d = Tier.Tier(short_name="tier_d")
41  tier_d.metric.input_events = 100
42  tier_d.metric.output_events = [50]
43  tier_d.metric.user_cpu = 100.
44  tier_d.metric.system_cpu = 14.
45  tier_d.dependencies = ['tier_c']
46  chain.AddTier(tier_d)
47 
49  print times
50 
51  base_html = """
52  <html>
53  <head>
54  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
55  <!--HEADER_HOOK-->
56  </head>
57  <body>
58  <!--BODY_HOOK-->
59  </body>
60  </html>
61  """
62  options = Tier.Tier()
63  options.path ="./"
64  head_html = ViewGoogleCharts.tierProjectionBarChart(chain,options)
65  base_html = base_html.replace("<!--HEADER_HOOK-->",head_html)
66  body_html = """
67  <div id="chart_div_%s" style="width: 900px; height: 500px;"></div>
68  """%chain.name
69  base_html = base_html.replace("<!--BODY_HOOK-->",body_html)
70 
71 
72  output = open("test_ViewGoogleCharts.html","w")
73  output.write(base_html)
74  output.close()
75  print "test : ---"
76 ###########################
77 # projection from multiple chains
78 print "test : --- Projection from Directories"
79 directory = "/nusoft/app/web/htdoc/nova/production/testing/FA14-10-03_2014-10-10-09-09-50/"
80 head_html, body_sections = ViewGoogleCharts.directoryProjectionBarChart("test","test",directory,"./")
81 base_html = """
82 <html>
83  <head>
84  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
85  <!--HEADER_HOOK-->
86  </head>
87  <body>
88  <!--BODY_HOOK-->
89  </body>
90 </html>
91 """
92 base_html = base_html.replace("<!--HEADER_HOOK-->",head_html)
93 body_html = \
94 """
95 <section>
96  <div class="page-header">
97  <h2 id="per_event">Per event times</h2>
98  </div>
99  %s
100  <hr>
101 </section>
102 <hr>
103 <section>
104  <div class="page-header">
105  <h2 id="projection">Projected times</h2>
106  </div>
107  <p class="lead">
108  The projections were made using the assumptions detailed in the table below.
109  Where a tier is not explicitly mentioned it follows the pattern of the default
110  tier of it's chain. The efficiencies quoted should reflect that measured in
111  the <a href="index.html">results section</a> of this test.
112  </p>
113  <!--ASSUMPTIONS_HOOK-->
114  <hr>
115  %s
116  <hr>
117  %s
118  <hr>
119 </section>
120 <section>
121 <div class="page-header">
122  <h2 id="sizes">Projected sizes</h2>
123  </div>
124  <p class="lead">
125  Similarly we project the size of the final output files based on the measured
126  size per output event.
127  </p>
128  %s
129  <hr>
130  %s
131  <hr>
132  %s
133 </section>
134 """%body_sections
135 base_html = base_html.replace("<!--BODY_HOOK-->",body_html)
136 
137 
138 output = open("test_ViewGoogleCharts.html","w")
139 output.write(base_html)
140 output.close()
141 print base_html
142 print "test : ---"
def projectionTimes(chain, per_input_event=False, verbose=False)
Build a projection of the time it will take to build a dataset.
Definition: Projections.py:3
Definition: Tier.py:1
procfile open("FD_BRL_v0.txt")
def tierProjectionBarChart(chain, options)
Projection bar charts.
def directoryProjectionBarChart(name, title, directory, path, unpickled_chains={}, verbose=False, rounding=False)
Entire test Projection bar charts.