summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-10-22 13:15:53 +0000
committerRichard Maw <richard.maw@gmail.com>2014-10-22 13:15:53 +0000
commitade6bf6bcfce5e6b365e593a5580a024c2329384 (patch)
tree1eaefee27ca84f25d49ffdcc09c4441c4a9a4162
parent06f1c4500cdbd612a39e41323ae2c28e4d307f0b (diff)
downloadcmdtest-baserock/richardmaw/parallel.tar.gz
yarn: Improve parallel testing progress reportingbaserock/richardmaw/parallel
Previously it would list [x/y] where x was the step id, and y was the total number of steps. This stopped producing sensible output after we started being able to run scenarios in parallel, since jobs were started in non-sequential id order. Now it's just a counter, with x as the number of steps completed. This also fixes it listing the wrong scenario name for each step, since previously it would set the scenario name when a scenario was started, now since they are interleaved, we need to report it when we start a new step. Also, as a consequence of moving to ID order, we need to adjust the steps completed when we skip because an ASSUMING failed. It may be better to make the scenario runners track the number of remaining steps, since we're currently encoding this information both in the runner, and in yarn where we're reporting status.
-rwxr-xr-xyarn21
1 files changed, 13 insertions, 8 deletions
diff --git a/yarn b/yarn
index 811e41d..1cfa801 100755
--- a/yarn
+++ b/yarn
@@ -38,7 +38,7 @@ def dry_scenario_runner_factory(info, ts):
def run_scenario(self, scenario, datadir, homedir):
info('Pretending everything went OK')
for step in scenario.steps:
- ts['current_step'] = step
+ ts['steps_completed'] += 1
return True
return DryScenarioRunner
@@ -131,7 +131,8 @@ class YarnRunner(cliapp.Application):
self.ts = ttystatus.TerminalStatus(period=0.001)
if not self.settings['quiet'] and not self.settings['verbose']:
self.ts.format(
- '%ElapsedTime() %Index(current_step,all_steps): '
+ '%ElapsedTime() '
+ '[%Integer(steps_completed)/%Integer(total_steps)]: '
'%String(scenario_name): '
'%String(step_name)')
@@ -153,7 +154,8 @@ class YarnRunner(cliapp.Application):
all_steps = []
for scenario in scenarios:
all_steps.extend(scenario.steps)
- self.ts['all_steps'] = all_steps
+ self.ts['total_steps'] = len(all_steps)
+ self.ts['steps_completed'] = 0
self.scenarios_run = 0
self.skipped_for_assuming = 0
@@ -273,8 +275,6 @@ class YarnRunner(cliapp.Application):
started = time.time()
self.info('Running scenario %s' % scenario.name)
- self.ts['scenario_name'] = scenario.name
- self.scenarios_run += 1
self.info('DATADIR is %s' % datadir)
self.info('HOME for tests is %s' % homedir)
return (started,)
@@ -283,18 +283,18 @@ class YarnRunner(cliapp.Application):
stopped = time.time()
started, = pre_scenario_userdata
+ self.scenarios_run += 1
self.remember_scenario_timing(stopped - started)
if not self.settings['snapshot']:
shutil.rmtree(datadir, ignore_errors=True)
- def pre_step(self, step, **ignored):
+ def pre_step(self, scenario, step, **ignored):
started = time.time()
self.info('Running step "%s %s"' % (step.what, step.text))
- self.ts['current_step'] = step
+ self.ts['scenario_name'] = scenario.name
self.ts['step_name'] = '%s %s' % (step.what, step.text)
- self.steps_run += 1
return (started,)
@@ -303,6 +303,9 @@ class YarnRunner(cliapp.Application):
stopped = time.time()
(started,) = pre_step_userdata
+ self.steps_run += 1
+ self.ts['steps_completed'] += 1
+
logging.debug('Exit code: %d' % exit)
if stdout:
logging.debug('Standard output:\n%s' % self.indent(stdout))
@@ -318,6 +321,8 @@ class YarnRunner(cliapp.Application):
'Skipping "%s" because "%s %s" failed' %
(scenario.name, step.what, step.text))
self.skipped_for_assuming += 1
+ skipped = len(scenario.steps) - scenario.steps.index(step) - 1
+ self.ts['total_steps'] -= skipped
else:
self.error(
'ERROR: In scenario "%s"\nstep "%s %s" failed,\n'