def test_workload(self): workloadServer = self.cluster[0] # -- add a proxy node if called for if opts["use-proxy"]: utils.print_with_time('Using proxy') workloadServer = driver.ProxyProcess(self.cluster, console_output='proxy-output', command_prefix=command_prefix, extra_options=serve_options) self.cluster.wait_until_ready() # -- run workload workload_runner.run(opts["workload"], workloadServer, opts["timeout"], db_name=self.dbName, table_name=self.tableName) utils.print_with_time("Ended workload: %s" % opts["workload"])
driver.Process(cluster, driver.Files(metacluster, db_path="db-%d" % i, log_path="create-output-%d" % i, executable_path=executable_path, command_prefix=command_prefix), log_path="serve-output-%d" % i, executable_path=executable_path, command_prefix=command_prefix, extra_options=serve_options) for i in xrange(opts["num-nodes"]) ] if opts["use-proxy"]: proxy_process = driver.ProxyProcess(cluster, 'proxy-logfile', log_path='proxy-output', executable_path=executable_path, command_prefix=command_prefix, extra_options=serve_options) processes.append(proxy_process) for process in processes: process.wait_until_started_up() print "Creating namespace..." http = http_admin.ClusterAccess([("localhost", p.http_port) for p in processes]) dc = http.add_datacenter() for machine_id in http.machines: http.move_server_to_datacenter(machine_id, dc) ns = scenario_common.prepare_table_for_workload(opts, http, primary=dc) for i in xrange(opts["num-shards"] - 1): http.add_namespace_shard(ns,
# remove --cache-size for option in serve_options[:]: if option == '--cache-size': position = serve_options.index(option) serve_options.pop(position) if len( serve_options ) > position: # we have at least one more option... the cache size serve_options.pop(position) break # we can only handle one elif option.startswith('--cache-size='): serve_options.remove(option) proxy_process = driver.ProxyProcess(server.cluster, 'proxy-logfile', console_output='proxy-output', command_prefix=command_prefix, extra_options=serve_options) server.cluster.wait_until_ready() print("Creating db/table %s/%s (%.2fs)" % (dbName, tableName, time.time() - startTime)) if dbName not in r.db_list().run(conn): r.db_create(dbName).run(conn) if tableName in r.db(dbName).table_list().run(conn): r.db(dbName).table_drop(tableName).run(conn) r.db(dbName).table_create(tableName).run(conn) print("Starting workload: %s (%.2fs)" % (opts["workload"], time.time() - startTime))