Merge lp:~kalebral-deactivatedaccount/drizzle-automation/dbt2-script-changes into lp:drizzle-automation

Proposed by Lee Bieber
Status: Merged
Merged at revision: not available
Proposed branch: lp:~kalebral-deactivatedaccount/drizzle-automation/dbt2-script-changes
Merge into: lp:drizzle-automation
Diff against target: 93 lines (+20/-20)
1 file modified
drizzle/automation/dbt2/run.py (+20/-20)
To merge this branch: bzr merge lp:~kalebral-deactivatedaccount/drizzle-automation/dbt2-script-changes
Reviewer Review Type Date Requested Status
Jay Pipes Approve
Review via email: mp+17699@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

changes necessary to get dbt2 benchmark to run with the latest dbt2 scripts

Revision history for this message
Jay Pipes (jaypipes) wrote :

Cool.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzle/automation/dbt2/run.py'
--- drizzle/automation/dbt2/run.py 2010-01-07 20:48:08 +0000
+++ drizzle/automation/dbt2/run.py 2010-01-19 23:49:11 +0000
@@ -76,6 +76,12 @@
76 db.execute_sql(sql)76 db.execute_sql(sql)
77 fileHandle.close()77 fileHandle.close()
7878
79# location where test results are stored, dbt2 expects it to not exist
80def remove_directory(output_dirname):
81 if os.path.exists(output_dirname):
82 logging.info("Removing %s" % output_dirname)
83 import shutil
84 shutil.rmtree(output_dirname)
7985
80def execute(processing_mode, variables):86def execute(processing_mode, variables):
81 # Set/verify some required variables, depending on the server we are benchmarking.87 # Set/verify some required variables, depending on the server we are benchmarking.
@@ -144,14 +150,6 @@
144 # clean data directory (var)150 # clean data directory (var)
145 server.clear()151 server.clear()
146152
147 # Start up the server...
148 server.start()
149
150 # create test database
151 if not util.drop_and_create_test_database(client):
152 server.stop()
153 sys.exit(1)
154
155 # If we are profiling, we must now stop and restart the server153 # If we are profiling, we must now stop and restart the server
156 # under the profiler now that the database is prepared154 # under the profiler now that the database is prepared
157 util.get_profile_options(server,variables['profiler'])155 util.get_profile_options(server,variables['profiler'])
@@ -164,39 +162,41 @@
164162
165 # location of dbt2 tools and scripts163 # location of dbt2 tools and scripts
166 dbt2_home= dbt2_config_variables['run']['dbt2_home']164 dbt2_home= dbt2_config_variables['run']['dbt2_home']
165
167 bzr_revision= variables['bzr_revision']166 bzr_revision= variables['bzr_revision']
168 test_time= dbt2_config_variables['run']['dbt2_time']167 test_time= dbt2_config_variables['run']['dbt2_time']
169 warehouses= dbt2_config_variables['run']['dbt2_warehouses']168 warehouses= dbt2_config_variables['run']['dbt2_warehouses']
170169
171 # location where test results are stored
172 output_dirname= ('dbt2-%s' % (bzr_revision))
173 if not os.path.isdir(output_dirname):
174 logging.info("Creating %s" % output_dirname)
175 os.mkdir(output_dirname)
176
177 # load data into database170 # load data into database
171 server.start()
178 cmd= "%s/bin/drizzle/dbt2-drizzle-load-db --path %s --verbose --drizzle_path %s" % (dbt2_home, dbt2_config_variables['run']['dbt2_data_dir'], os.path.join(working_dir, 'client/drizzle'))172 cmd= "%s/bin/drizzle/dbt2-drizzle-load-db --path %s --verbose --drizzle_path %s" % (dbt2_home, dbt2_config_variables['run']['dbt2_data_dir'], os.path.join(working_dir, 'client/drizzle'))
179 logging.info("Loading data.... ")173 logging.info("Loading data.... %s " % cmd)
180 logging.info("%s " % cmd)
181 (retcode, output)= commands.getstatusoutput(cmd)174 (retcode, output)= commands.getstatusoutput(cmd)
182 if not retcode == 0:175 if not retcode == 0:
183 logging.info("Failed to load data\n%s" % output)176 logging.info("Failed to load data\n%s" % output)
184 sys.exit(1)177 sys.exit(1)
178 server.stop()
185179
186 # get list of connections to run with180 # get list of connections to run with
187 connection_levels= [int(x) for x in dbt2_config_variables['run']['dbt2_connections'].split(",")]181 connection_levels= [int(x) for x in dbt2_config_variables['run']['dbt2_connections'].split(",")]
188 182
183 # need to set the path so we can find the dbt2 scripts
184 temp_env= os.environ["PATH"]
185 os.environ["PATH"] = "%s:%s/bin" % (temp_env, dbt2_home)
186 logging.info("Setting PATH environment variable to %s" % os.environ["PATH"])
187
189 # run the tests188 # run the tests
189 # Note that the tests start and stop drizzled after each run
190 for connections in connection_levels: 190 for connections in connection_levels:
191 cmd= "%s/bin/drizzle/dbt2-drizzle-run --connections %d --time %d --warehouses %d --verbose --output-base %s --run-number %s" % (dbt2_home, connections, int(test_time), int(warehouses), output_dirname, connections)191 output_dirname= "results-%s/%s" % (bzr_revision, connections)
192 remove_directory(output_dirname)
193 cmd= "%s/bin/dbt2-run-workload -a drizzle -c %d -d %d -w %d -o %s -i %s -l %d -b 40" % (dbt2_home, connections, int(test_time), int(warehouses), output_dirname, working_dir, server.getPort())
192 logging.info("Running %s " % cmd)194 logging.info("Running %s " % cmd)
193 (retcode, output)= commands.getstatusoutput(cmd)195 (retcode, output)= commands.getstatusoutput(cmd)
194 if not retcode == 0:196 if not retcode == 0:
195 logging.info("Failed to run test with %d connections\n%s" % (connections,output))197 logging.info("Failed to run test with %d connections\n%s" % (connections,output))
196 sys.exit(1)198 sys.exit(1)
197199
198 server.stop()
199
200 if variables['no_store_db'] is False:200 if variables['no_store_db'] is False:
201201
202 util.log_sysbench_run(run_id, config_id, server_name, server_version, run_date)202 util.log_sysbench_run(run_id, config_id, server_name, server_version, run_date)
@@ -204,7 +204,7 @@
204 # We now log the results of this run - 204 # We now log the results of this run -
205 logging.info("Logging dbt2 revision %s results to database for run %d" % (bzr_revision, run_id))205 logging.info("Logging dbt2 revision %s results to database for run %d" % (bzr_revision, run_id))
206 for connections in connection_levels: 206 for connections in connection_levels:
207 stat_file= ("%s/%s/output/%d/driver/statistics.log" % (working_dir, output_dirname, connections))207 stat_file= ("%s/results-%s/%s/report.txt" % (working_dir, bzr_revision, connections))
208 log_dbt2_iteration(run_id, connections, test_time, warehouses, stat_file)208 log_dbt2_iteration(run_id, connections, test_time, warehouses, stat_file)
209209
210 # send email report210 # send email report

Subscribers

People subscribed via source and target branches

to all changes: