aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/run_performance_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/run_tests/run_performance_tests.py')
-rwxr-xr-xtools/run_tests/run_performance_tests.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py
index e1268e2ecb..51ed35f760 100755
--- a/tools/run_tests/run_performance_tests.py
+++ b/tools/run_tests/run_performance_tests.py
@@ -33,8 +33,10 @@
import argparse
import itertools
import jobset
+import json
import multiprocessing
import os
+import pipes
import subprocess
import sys
import tempfile
@@ -87,18 +89,34 @@ def create_qpsworker_job(language, shortname=None,
return QpsWorkerJob(jobspec, language, host_and_port)
-def create_scenario_jobspec(scenario_name, driver_args, workers, remote_host=None):
+def create_scenario_jobspec(scenario_json, workers, remote_host=None):
"""Runs one scenario using QPS driver."""
# setting QPS_WORKERS env variable here makes sure it works with SSH too.
- cmd = 'QPS_WORKERS="%s" bins/opt/qps_driver ' % ','.join(workers)
- cmd += ' '.join(driver_args)
+ cmd = 'QPS_WORKERS="%s" bins/opt/qps_json_driver ' % ','.join(workers)
+ cmd += '--scenarios_json=%s' % pipes.quote(json.dumps({'scenarios': [scenario_json]}))
if remote_host:
user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host)
cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && %s"' % (user_at_host, cmd)
return jobset.JobSpec(
cmdline=[cmd],
- shortname='qps_driver.%s' % scenario_name,
+ shortname='qps_json_driver.%s' % scenario_json['name'],
+ timeout_seconds=3*60,
+ shell=True,
+ verbose_success=True)
+
+
+def create_quit_jobspec(workers, remote_host=None):
+ """Runs quit using QPS driver."""
+ # setting QPS_WORKERS env variable here makes sure it works with SSH too.
+ cmd = 'QPS_WORKERS="%s" bins/opt/qps_driver --quit' % ','.join(workers)
+ if remote_host:
+ user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host)
+ cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && %s"' % (user_at_host, cmd)
+
+ return jobset.JobSpec(
+ cmdline=[cmd],
+ shortname='qps_driver.quit',
timeout_seconds=3*60,
shell=True,
verbose_success=True)
@@ -207,9 +225,8 @@ def create_scenarios(languages, workers_by_lang, remote_host=None):
"""Create jobspecs for scenarios to run."""
scenarios = []
for language in languages:
- for scenario_name, driver_args in language.scenarios().iteritems():
- scenario = create_scenario_jobspec(scenario_name,
- driver_args,
+ for scenario_json in language.scenarios():
+ scenario = create_scenario_jobspec(scenario_json,
workers_by_lang[str(language)],
remote_host=remote_host)
scenarios.append(scenario)
@@ -218,10 +235,7 @@ def create_scenarios(languages, workers_by_lang, remote_host=None):
all_workers = [worker
for workers in workers_by_lang.values()
for worker in workers]
- scenarios.append(create_scenario_jobspec('quit_workers',
- ['--quit=true'],
- all_workers,
- remote_host=remote_host))
+ scenarios.append(create_quit_jobspec(all_workers, remote_host=remote_host))
return scenarios