summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-10-15 13:33:52 +0000
committerRichard Maw <richard.maw@gmail.com>2014-10-15 14:10:05 +0000
commit03b9e8e9c0383a96da2bbb44ed11949a35eab6ad (patch)
treed5e238caf606d2cb3773aed20dcd9c79c734dc58
parenta23193fc77c025a723f041d4308684d268c02760 (diff)
downloadcmdtest-03b9e8e9c0383a96da2bbb44ed11949a35eab6ad.tar.gz
yarn: Allow multi-runner when called with -jN
-rwxr-xr-xyarn10
1 files changed, 10 insertions, 0 deletions
diff --git a/yarn b/yarn
index bb5759a..00a8a46 100755
--- a/yarn
+++ b/yarn
@@ -19,6 +19,7 @@
import cliapp
import collections
+import functools
import logging
import os
import re
@@ -94,6 +95,12 @@ class YarnRunner(cliapp.Application):
'allow scenarios to reference steps that do not exist, '
'by warning about them, but otherwise ignoring the scenarios')
+ self.settings.integer(
+ ['max-jobs', 'j'],
+ 'run as many as JOBS scenarios in parallel',
+ default=1,
+ metavar='JOBS')
+
def info(self, msg):
if self.settings['verbose']:
logging.info(msg)
@@ -155,6 +162,9 @@ class YarnRunner(cliapp.Application):
if self.settings['no-act']:
runner_class = dry_scenario_runner_factory(self.info, self.ts)
+ elif self.settings['max-jobs'] > 1:
+ runner_class = functools.partial(yarnlib.ScenarioMultiRunner,
+ max_jobs=self.settings['max-jobs'])
else:
runner_class = yarnlib.ScenarioRunner
scenario_runner = runner_class(shell_prelude, os.getcwd(),