def test_get_limits_conf(self): """ `get_step_limits_from_conf` will return configured limit along with default limit """ limits = get_step_limits_from_conf({"create_server": 100}) self.assertEqual(limits, {CreateServer: 100, CreateStack: 10})
def __init__(self, log, dispatcher, num_buckets, partitioner_factory, build_timeout, interval, limited_retry_iterations, step_limits, converge_all_groups=converge_all_groups): """ :param log: a bound log :param dispatcher: The dispatcher to use to perform effects. :param int buckets: the number of logical `buckets` which are be shared between all Otter nodes running this service. The buckets will be partitioned up between nodes to detirmine which nodes should work on which groups. :param partitioner_factory: Callable of (all_buckets, log, callback) which should create an :obj:`Partitioner` to distribute the buckets. :param number build_timeout: number of seconds to wait for servers to be in building before it's is timed out and deleted :param interval: Interval between convergence steps, per group. :param callable converge_all_groups: like :func:`converge_all_groups`, to be used for test injection only :param int limited_retry_iterations: number of iterations to wait for LIMITED_RETRY steps :param dict step_limits: Mapping of step name to number of executions allowed in a convergence cycle """ MultiService.__init__(self) self.log = log.bind(otter_service='converger') self._dispatcher = dispatcher self._buckets = range(num_buckets) self.partitioner = partitioner_factory( buckets=self._buckets, log=self.log, got_buckets=self.buckets_acquired) self.partitioner.setServiceParent(self) self.build_timeout = build_timeout self._converge_all_groups = converge_all_groups self.interval = interval self.limited_retry_iterations = limited_retry_iterations self.step_limits = get_step_limits_from_conf(step_limits) # ephemeral mutable state self.currently_converging = Reference(pset()) self.recently_converged = Reference(pmap()) # Groups we're waiting on temporarily, and may give up on. self.waiting = Reference(pmap()) # {group_id: num_iterations_waited}