[autotest] Pull suite sharding factor from global_config.ini
Instead of hard-coding a sharding factor in each suite control file,
put a default one in global_config.ini. Allow overrides.
BUG=chromium-os:26431
TEST=unit
TEST=use dev_harness to run control.bvt, see that it schedules 5 reimaging jobs.
STATUS=Fixed
Change-Id: Ife5a1d117701785530b040ab9b08796b06d57f76
Reviewed-on: https://gerrit.chromium.org/gerrit/15975
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Chris Masone <cmasone@chromium.org>
diff --git a/server/cros/dynamic_suite.py b/server/cros/dynamic_suite.py
index fbdd9a0..ecf1b7b 100644
--- a/server/cros/dynamic_suite.py
+++ b/server/cros/dynamic_suite.py
@@ -64,7 +64,7 @@
return 'SKIP_IMAGE' in g and g['SKIP_IMAGE']
- def attempt(self, build, num, board, record):
+ def attempt(self, build, board, record, num=None):
"""
Synchronously attempt to reimage some machines.
@@ -74,13 +74,16 @@
@param build: the build to install e.g.
x86-alex-release/R18-1655.0.0-a1-b1584.
- @param num: how many devices to reimage.
@param board: which kind of devices to reimage.
@param record: callable that records job status.
prototype:
record(status, subdir, name, reason)
+ @param num: how many devices to reimage.
@return True if all reimaging jobs succeed, false otherwise.
"""
+ if not num:
+ num = CONFIG.get_config_value('CROS', 'sharding_factor', type=int)
+ logging.debug("scheduling reiamging across %d machines", num)
wrapper_job_name = 'try new image'
record('START', None, wrapper_job_name)
self._ensure_version_label(VERSION_PREFIX + build)