def _get_batches(targ_cap, curr_cap, batch_size, min_in_service):
        updated = 0

        while rolling_update.needs_update(targ_cap, curr_cap, updated):
            new_cap, total_new = rolling_update.next_batch(targ_cap, curr_cap, updated, batch_size, min_in_service)

            yield new_cap, total_new

            updated += total_new - max(new_cap - max(curr_cap, targ_cap), 0)
            curr_cap = new_cap
Exemple #2
0
    def _get_batches(targ_cap, curr_cap, batch_size, min_in_service):
        updated = 0

        while rolling_update.needs_update(targ_cap, curr_cap, updated):
            new_cap, total_new = rolling_update.next_batch(
                targ_cap, curr_cap, updated, batch_size, min_in_service)

            yield new_cap, total_new

            updated += total_new - max(new_cap - max(curr_cap, targ_cap), 0)
            curr_cap = new_cap
Exemple #3
0
    def _get_batches(capacity, batch_size, min_in_service):
        """Return an iterator over the batches in a batched update.

        Each batch is a tuple comprising the total size of the group after
        processing the batch, and the number of members that can receive the
        new definition in that batch (either by creating a new member or
        updating an existing one).
        """

        efft_capacity = capacity
        updated = 0

        while rolling_update.needs_update(capacity, efft_capacity, updated):
            batch = rolling_update.next_batch(capacity, efft_capacity, updated, batch_size, min_in_service)
            yield batch
            efft_capacity, num_updates = batch
            updated += num_updates
Exemple #4
0
    def _get_batches(target_capacity, capacity, batch_size, min_in_service):
        """Return an iterator over the batches in a batched update.

        Each batch is a tuple comprising the total size of the group after
        processing the batch, and the number of members that can receive the
        new definition in that batch (either by creating a new member or
        updating an existing one).
        """

        updated = 0

        while rolling_update.needs_update(target_capacity, capacity, updated):
            batch = rolling_update.next_batch(target_capacity, capacity,
                                              updated, batch_size,
                                              min_in_service)
            yield batch
            capacity, num_updates = batch
            updated += num_updates
 def test_needs_update(self):
     needs_update = rolling_update.needs_update(self.targ, self.curr,
                                                self.updated)
     self.assertEqual(self.result, needs_update)
 def test_needs_update(self):
     needs_update = rolling_update.needs_update(self.targ, self.curr,
                                                self.updated)
     self.assertEqual(self.result, needs_update)