[autotest] Only integer or None as num argument in create_suite_job
Cleanup to reduce confusion and type casting back and forth between int
and string.
BUG=chromium-os:37936
TEST=unit test that non-integer or None num arguments throw appropriate
exception; unit test that integer arguments get passed along correctly;
ran a suite locally to ensure rpc call still working
Change-Id: Id8b8e0dd5a08db2ebec67cdba13b2b1d8eb0b149
Reviewed-on: https://gerrit.chromium.org/gerrit/41791
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
diff --git a/site_utils/suite_scheduler/deduping_scheduler.py b/site_utils/suite_scheduler/deduping_scheduler.py
index 550c5dc..fd99196 100644
--- a/site_utils/suite_scheduler/deduping_scheduler.py
+++ b/site_utils/suite_scheduler/deduping_scheduler.py
@@ -4,7 +4,6 @@
import logging
from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
-from autotest_lib.server import frontend
class DedupingSchedulerException(Exception):
@@ -73,6 +72,7 @@
@param pool: the pool of machines to use for scheduling purposes.
Default: None
@param num: the number of devices across which to shard the test suite.
+ Type: integer or None
Default: None (uses sharding factor in global_config.ini).
@return True if the suite got scheduled
@raise ScheduleException if an error occurs while scheduling.
@@ -107,6 +107,7 @@
x86-alex-release/R18-1655.0.0-a1-b1584.
@param pool: the pool of machines to use for scheduling purposes.
@param num: the number of devices across which to shard the test suite.
+ Type: integer or None
@param force: Always schedule the suite.
@return True if the suite got scheduled, False if not
@raise DedupException if we can't check for dups.
diff --git a/site_utils/suite_scheduler/task.py b/site_utils/suite_scheduler/task.py
index c53938a..4e32fed 100644
--- a/site_utils/suite_scheduler/task.py
+++ b/site_utils/suite_scheduler/task.py
@@ -4,7 +4,7 @@
import logging, re
-import deduping_scheduler, forgiving_config_parser
+import deduping_scheduler
from distutils import version
from constants import Labels
@@ -136,13 +136,14 @@
@param pool: the pool of machines to use for scheduling purposes.
Default: None
@param num: the number of devices across which to shard the test suite.
+ Type: integer or None
Default: None
"""
self._name = name
self._suite = suite
self._branch_specs = branch_specs
self._pool = pool
- self._num = '%d' % num if num else None
+ self._num = num
self._bare_branches = []
if not branch_specs:
@@ -159,7 +160,7 @@
# Since we expect __hash__() and other comparitor methods to be used
# frequently by set operations, and they use str() a lot, pre-compute
# the string representation of this object.
- self._str = '%s: %s on %s with pool %s, across %r machines' % (
+ self._str = '%s: %s on %s with pool %s, across %d machines' % (
self.__class__.__name__, suite, branch_specs, pool, num)