(
        self, target_capacity: float, *, dry_run: bool = False, honor_cooldown: bool = False,
    )
Modify the desired capacity for the ASG.

        :param target_capacity: The new desired number of instances in th ASG.
            Must be such that the desired capacity is between the minimum and
            maximum capacities of the ASGs. The desired capacity will be rounded
            to the minimum or maximum otherwise, whichever is closer.
        :param dry_run: Boolean indicating whether or not to take action or just
            log
        :param honor_cooldown: Boolean for whether or not to wait for a period
            of time (cooldown, set in ASG config) after the previous scaling
            activity has completed before initiating this one. Defaults to False,
            which is the AWS default for manual scaling activities.
Modify the desired capacity for the ASG.
Modify the desired capacity for the ASG .
def modify_target_capacity(
        self, target_capacity: float, *, dry_run: bool = False, honor_cooldown: bool = False,
    ) -> None:
        """ Modify the desired capacity for the ASG.

        :param target_capacity: The new desired number of instances in th ASG.
            Must be such that the desired capacity is between the minimum and
            maximum capacities of the ASGs. The desired capacity will be rounded
            to the minimum or maximum otherwise, whichever is closer.
        :param dry_run: Boolean indicating whether or not to take action or just
            log
        :param honor_cooldown: Boolean for whether or not to wait for a period
            of time (cooldown, set in ASG config) after the previous scaling
            activity has completed before initiating this one. Defaults to False,
            which is the AWS default for manual scaling activities.
        """
        # We pretend like stale instances aren't in the ASG, but actually they are so
        # we have to double-count them in the target capacity computation
        target_capacity += self._stale_capacity

        # Round target_cpacity to min or max if necessary
        if target_capacity > self.max_capacity:
            logger.warning(
                f"New target_capacity={target_capacity} exceeds ASG MaxSize={self.max_capacity}, "
                "setting to max instead"
            )
            target_capacity = self.max_capacity
        elif target_capacity < self.min_capacity:
            logger.warning(
                f"New target_capacity={target_capacity} falls below ASG MinSize={self.min_capacity}, "
                "setting to min instead"
            )
            target_capacity = self.min_capacity

        kwargs = dict(
            AutoScalingGroupName=self.group_id, DesiredCapacity=int(target_capacity), HonorCooldown=honor_cooldown,
        )
        logger.info("Setting target capacity for ASG with arguments:\n" f"{pprint.pformat(kwargs)}")
        if dry_run:
            return

        autoscaling.set_desired_capacity(**kwargs)
def modify_target_capacity ( self , target_capacity : float , * , dry_run : bool = False , honor_cooldown : bool = False , ) -> None : # We pretend like stale instances aren't in the ASG, but actually they are so # we have to double-count them in the target capacity computation target_capacity += self . _stale_capacity # Round target_cpacity to min or max if necessary if target_capacity > self . max_capacity : logger . warning ( f"New target_capacity={target_capacity} exceeds ASG MaxSize={self.max_capacity}, " "setting to max instead" ) target_capacity = self . max_capacity elif target_capacity < self . min_capacity : logger . warning ( f"New target_capacity={target_capacity} falls below ASG MinSize={self.min_capacity}, " "setting to min instead" ) target_capacity = self . min_capacity kwargs = dict ( AutoScalingGroupName = self . group_id , DesiredCapacity = int ( target_capacity ) , HonorCooldown = honor_cooldown , ) logger . info ( "Setting target capacity for ASG with arguments:\n" f"{pprint.pformat(kwargs)}" ) if dry_run : return autoscaling . set_desired_capacity ( * * kwargs )