Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 import argparse | 2 import argparse |
3 import json | 3 import json |
4 import os | 4 import os |
5 import logging | 5 import logging |
6 | 6 |
7 import pytools.experiments.job_generator as jobgen | 7 import pytools.experiments.job_generator as jobgen |
8 from pytools.ycsb.ycsb_runner import generate_sub_exp_folder_based_on_args | 8 from pytools.ycsb.ycsb_runner import generate_sub_exp_folder_based_on_args |
9 from pytools.common.common import print_generic_exception | 9 from pytools.common.common import print_generic_exception |
10 from common.lx3.common import get_config_json | 10 from common.lx3.common import get_config_json |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 def run_multiconf_threads_and_plot(FLAGS, conf): | 85 def run_multiconf_threads_and_plot(FLAGS, conf): |
86 """ | 86 """ |
87 Run experiment with varying YCSB thread loads and draw plots (1.5) | 87 Run experiment with varying YCSB thread loads and draw plots (1.5) |
88 :param FLAGS: | 88 :param FLAGS: |
89 :param conf: | 89 :param conf: |
90 :return: | 90 :return: |
91 """ | 91 """ |
92 # We need the folders where these outputs are stored | 92 # We need the folders where these outputs are stored |
93 exp_out_folder = os.path.join(conf["env"]["out_exp_dir"], 'exp_outs') | 93 exp_out_folder = os.path.join(conf["env"]["out_exp_dir"], 'exp_outs') |
94 | 94 |
95 thread_count_results = [] | |
95 for thread_count in conf['multiconf_num_threads']: | 96 for thread_count in conf['multiconf_num_threads']: |
97 result_for_thread = { | |
98 'label': 'thread count', | |
99 'key': thread_count, | |
100 'result': None | |
101 } | |
96 conf['workload_1']['threads'] = thread_count | 102 conf['workload_1']['threads'] = thread_count |
97 output_folder = api.experiment_run(FLAGS, conf, net) | 103 output_folder = api.experiment_run(FLAGS, conf, net) |
98 | |
99 print("**********************************************************") | 104 print("**********************************************************") |
100 print( | 105 print( |
101 "Experiments finished for: {0} threads, and output at: {1}".format( | 106 "Experiments finished for: {0} threads, and output at: {1}".format( |
102 thread_count, output_folder | 107 thread_count, output_folder |
103 ) | 108 ) |
104 ) | 109 ) |
105 print("**********************************************************") | 110 print("**********************************************************") |
106 # At this point, we have the whole trial finished. plot now | 111 |
107 | 112 # store intermediate results |
108 api.plot_ycsb_data_from_output_folder( | 113 result_for_thread['result'] = api.get_yscb_data_from_output_folder( |
109 output_folder, where_to_save=exp_out_folder, | 114 output_folder |
110 label="Thread loads vs Throughput for load {0}".format( | 115 ) |
111 thread_count | 116 thread_count_results.append(result_for_thread) |
112 ) | 117 |
113 ) | 118 # All tests are finished at this point |
114 | 119 api.get_ycsb_plot_from_list( |
120 thread_count_results, where_to_save=exp_out_folder, | |
121 label="Thread loads" | |
122 ) | |
115 return | 123 return |
116 | 124 |
117 | 125 |
118 def run_multiconf_sleep_time(FLAGS, conf, net): | 126 def run_multiconf_sleep_time(FLAGS, conf, net): |
119 """ | 127 """ |
128 Run experiment with varying sleep times and draw plots (1.5) | |
120 :param FLAGS: | 129 :param FLAGS: |
121 :param conf: | 130 :param conf: |
122 :return: | 131 :return: |
123 """ | 132 """ |
124 | |
125 # We need the folders where these outputs are stored | 133 # We need the folders where these outputs are stored |
126 exp_out_folder = os.path.join(conf["env"]["out_exp_dir"], 'exp_outs') | 134 exp_out_folder = os.path.join(conf["env"]["out_exp_dir"], 'exp_outs') |
127 | 135 conf['workload_1']['threads'] = 4 # Default |
136 | |
137 sleep_time_results = [] | |
128 for sleep_time in conf['multiconf_sleep_time']: | 138 for sleep_time in conf['multiconf_sleep_time']: |
139 result_for_sleep_time = { | |
140 'label': 'sleep time', | |
141 'key': sleep_time, | |
142 'result': None | |
143 } | |
144 # Execute latency change with different sleep times | |
129 thread = Thread(target=api.execute_update_latencies, args=(FLAGS, conf, net, sleep_time)) | 145 thread = Thread(target=api.execute_update_latencies, args=(FLAGS, conf, net, sleep_time)) |
tonythomas
2017/10/14 10:03:08
also - when doing this - can you add an extra flag
| |
130 thread.start() | 146 thread.start() |
147 | |
131 output_folder = api.experiment_run(FLAGS, conf, net) | 148 output_folder = api.experiment_run(FLAGS, conf, net) |
132 | 149 |
133 print("**********************************************************") | 150 print("**********************************************************") |
134 print( | 151 print( |
135 "Experiments finished for: {0} sleep time, and output at: {1}".forma t( | 152 "Experiments finished for: {0} sleep time, and output at: {1}".forma t( |
136 sleep_time, output_folder | 153 sleep_time, output_folder |
137 ) | 154 ) |
138 ) | 155 ) |
139 print("**********************************************************") | 156 print("**********************************************************") |
140 # At this point, we have the whole trial finished. plot now | |
141 | |
142 api.plot_ycsb_data_from_output_folder( | |
143 output_folder, where_to_save=exp_out_folder, | |
144 label="Sleep Time vs Throughput for load {0}".format( | |
145 sleep_time | |
146 ) | |
147 ) | |
tonythomas
2017/10/14 10:03:08
for this patch to get working - we should use this
| |
148 | 157 |
149 thread.join() | 158 thread.join() |
150 return | 159 |
160 # store intermediate results | |
161 result_for_sleep_time['result'] = api.get_yscb_data_from_output_folder( | |
162 output_folder | |
163 ) | |
164 sleep_time_results.append(result_for_sleep_time) | |
165 | |
166 # All tests are finished at this point | |
167 api.get_ycsb_plot_from_list( | |
168 sleep_time_results, where_to_save=exp_out_folder, | |
169 label="Sleep Time" | |
170 ) | |
171 | |
151 | 172 |
152 | 173 |
153 def run_multiconf_jitter(FLAGS, conf): | 174 def run_multiconf_jitter(FLAGS, conf): |
154 """ | 175 """ |
155 Run experiment with varying Jitter levels and draw plots (1.5) | 176 Run experiment with varying Jitter levels and draw plots (1.5) |
156 :param FLAGS: | 177 :param FLAGS: |
157 :param conf: | 178 :param conf: |
158 :return: | 179 :return: |
159 """ | 180 """ |
160 # We need the folders where these outputs are stored | 181 # We need the folders where these outputs are stored |
161 exp_out_folder = os.path.join(conf["env"]["out_exp_dir"], 'exp_outs') | 182 exp_out_folder = os.path.join(conf["env"]["out_exp_dir"], 'exp_outs') |
162 conf['workload_1']['threads'] = 4 # Default | 183 conf['workload_1']['threads'] = 4 # Default |
163 | 184 |
185 jitter_level_results = [] | |
164 for jitter_level in conf['multiconf_jitter_levels']: | 186 for jitter_level in conf['multiconf_jitter_levels']: |
187 result_for_jitter = { | |
188 'label': 'jitter level', | |
189 'key': jitter_level, | |
190 'result': None | |
191 } | |
165 # Modify jitter level here with value | 192 # Modify jitter level here with value |
166 api.execute_update_jitter( | 193 api.execute_update_jitter( |
167 FLAGS, conf, net, jitter_level, distribution="normal" | 194 FLAGS, conf, net, jitter_level, distribution="normal" |
168 ) | 195 ) |
169 | 196 |
170 output_folder = api.experiment_run(FLAGS, conf, net) | 197 output_folder = api.experiment_run(FLAGS, conf, net) |
171 | 198 |
172 print("**********************************************************") | 199 print("**********************************************************") |
173 print( | 200 print( |
174 "Experiments finished for: {0} jitter, and output at: {1}".format( | 201 "Experiments finished for: {0} jitter, and output at: {1}".format( |
175 jitter_level, output_folder | 202 jitter_level, output_folder |
176 ) | 203 ) |
177 ) | 204 ) |
178 print("**********************************************************") | 205 print("**********************************************************") |
179 # At this point, we have the whole trial finished. plot now | 206 ········ |
180 | 207 # store intermediate results |
181 api.plot_ycsb_data_from_output_folder( | 208 result_for_jitter['result'] = api.get_yscb_data_from_output_folder( |
182 output_folder, where_to_save=exp_out_folder, | 209 output_folder |
183 label="Jitter level vs Throughput for jitter-level {0}".format( | 210 ) |
184 jitter_level | 211 jitter_level_results.append(result_for_jitter) |
185 ) | 212 |
186 ) | 213 # All tests are finished at this point |
214 api.get_ycsb_plot_from_list( | |
215 jitter_level_results, where_to_save=exp_out_folder, | |
216 label="Jitter levels" | |
217 ) | |
187 | 218 |
188 | 219 |
189 def setup_testbed(FLAGS, conf, launch_system=False): | 220 def setup_testbed(FLAGS, conf, launch_system=False): |
190 """ | 221 """ |
191 Basic setting up of testbed, usually required for every experiment | 222 Basic setting up of testbed, usually required for every experiment |
192 :param FLAGS: | 223 :param FLAGS: |
193 :param conf: | 224 :param conf: |
194 :param launch_system: | 225 :param launch_system: |
195 :return net mininet instance for future use | 226 :return net mininet instance for future use |
196 """ | 227 """ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 if FLAGS.multiconf: | 274 if FLAGS.multiconf: |
244 # Organizational stuff | 275 # Organizational stuff |
245 if FLAGS.repeat > 0: | 276 if FLAGS.repeat > 0: |
246 conf["cassandra"]["exp"]["repeat"] = FLAGS.repeat | 277 conf["cassandra"]["exp"]["repeat"] = FLAGS.repeat |
247 create_experiment_plot_data_dirs(conf=conf) | 278 create_experiment_plot_data_dirs(conf=conf) |
248 | 279 |
249 # Do initial setting up testbed here | 280 # Do initial setting up testbed here |
250 net = setup_testbed(FLAGS, conf, launch_system=True) | 281 net = setup_testbed(FLAGS, conf, launch_system=True) |
251 # Load YCSB stuff to the keyspace | 282 # Load YCSB stuff to the keyspace |
252 api.experiment_setup_keyspace(FLAGS, conf, net) | 283 api.experiment_setup_keyspace(FLAGS, conf, net) |
253 | |
254 # Run experiments one after other | 284 # Run experiments one after other |
255 print("#############################################################") | 285 print("#############################################################") |
256 print("Muliconf multi thread experiment started") | 286 print("Muliconf multi thread experiment started") |
257 #run_multiconf_threads_and_plot(FLAGS, conf) | 287 #run_multiconf_threads_and_plot(FLAGS, conf) |
258 print("Muliconf multi thread experiment finished") | 288 print("Muliconf multi thread experiment finished") |
259 print("#############################################################") | 289 print("#############################################################") |
260 | 290 |
261 print("#############################################################") | 291 print("#############################################################") |
262 print("Muliconf multi sleep time experiment started") | 292 print("Muliconf multi sleep time experiment started") |
263 run_multiconf_sleep_time(FLAGS, conf, net) | 293 run_multiconf_sleep_time(FLAGS, conf, net) |
(...skipping 15 matching lines...) Expand all Loading... | |
279 net = setup_testbed(FLAGS, conf, launch_system=False) | 309 net = setup_testbed(FLAGS, conf, launch_system=False) |
280 | 310 |
281 execute_ping_nodes_generate_output(conf=conf, net=net) | 311 execute_ping_nodes_generate_output(conf=conf, net=net) |
282 # start pinging and saving data here (so that we dont have to do it | 312 # start pinging and saving data here (so that we dont have to do it |
283 # again later) | 313 # again later) |
284 | 314 |
285 | 315 |
286 # Here we should execute further changes to testbed and plot | 316 # Here we should execute further changes to testbed and plot |
287 | 317 |
288 api.execute_update_latencies(FLAGS, conf, net, frequency=10) | 318 api.execute_update_latencies(FLAGS, conf, net, frequency=10) |
289 print("Exit") | 319 print("Exit") |
LEFT | RIGHT |