Merge pull request #8397 from apolcyn/fix_performance_test_silent_failures

fail performance tests if any jobs fail or timeout
pull/8471/head
apolcyn 8 years ago committed by GitHub
commit f89a4a189f
  1. 16
      tools/run_tests/run_performance_tests.py

@ -356,6 +356,7 @@ def create_scenarios(languages, workers_by_lang, remote_host=None, regex='.*',
def finish_qps_workers(jobs): def finish_qps_workers(jobs):
"""Waits for given jobs to finish and eventually kills them.""" """Waits for given jobs to finish and eventually kills them."""
retries = 0 retries = 0
num_killed = 0
while any(job.is_running() for job in jobs): while any(job.is_running() for job in jobs):
for job in qpsworker_jobs: for job in qpsworker_jobs:
if job.is_running(): if job.is_running():
@ -364,10 +365,11 @@ def finish_qps_workers(jobs):
print('Killing all QPS workers.') print('Killing all QPS workers.')
for job in jobs: for job in jobs:
job.kill() job.kill()
num_killed += 1
retries += 1 retries += 1
time.sleep(3) time.sleep(3)
print('All QPS workers finished.') print('All QPS workers finished.')
return num_killed
argp = argparse.ArgumentParser(description='Run performance tests.') argp = argparse.ArgumentParser(description='Run performance tests.')
argp.add_argument('-l', '--language', argp.add_argument('-l', '--language',
@ -449,6 +451,8 @@ scenarios = create_scenarios(languages,
if not scenarios: if not scenarios:
raise Exception('No scenarios to run') raise Exception('No scenarios to run')
total_scenario_failures = 0
qps_workers_killed = 0
for scenario in scenarios: for scenario in scenarios:
if args.dry_run: if args.dry_run:
print(scenario.name) print(scenario.name)
@ -456,8 +460,14 @@ for scenario in scenarios:
try: try:
for worker in scenario.workers: for worker in scenario.workers:
worker.start() worker.start()
jobset.run([scenario.jobspec, scenario_failures, _ = jobset.run([scenario.jobspec,
create_quit_jobspec(scenario.workers, remote_host=args.remote_driver_host)], create_quit_jobspec(scenario.workers, remote_host=args.remote_driver_host)],
newline_on_success=True, maxjobs=1) newline_on_success=True, maxjobs=1)
total_scenario_failures += scenario_failures
finally: finally:
finish_qps_workers(scenario.workers) # Consider qps workers that need to be killed as failures
qps_workers_killed += finish_qps_workers(scenario.workers)
if total_scenario_failures > 0 or qps_workers_killed > 0:
print ("%s scenarios failed and %s qps worker jobs killed" % (total_scenario_failures, qps_workers_killed))
sys.exit(1)

Loading…
Cancel
Save