app/src/mutations/scale.py
async def scale_deployment(name: str, namespace: str, replicas: int,
                           timeout: timedelta):
    """Updates a Deployment's scale and waits for cluster state to reconcile.

    Args:
        name: Name of the Deployment.
        namespace: Namespace of the Deployment.
        replicas: Desired number of replicas.
        timeout: Time to wait for reconciliation until failing.

    Raises:
        ReconciliationError:
            The cluster state did not reconcile within timeout.
    """
    previous_replicas = get_scale_for_deployment(name, namespace)
    update_deployment_scale(name, namespace, replicas)

    try:
        api = client.AppsV1Api()
        predicate = deployment_has_scale(replicas)
        await wait_for_reconciliation(
            predicate,
            timeout,
            api.read_namespaced_deployment,
            name,
            namespace
        )
    except ReconciliationError:
        log.warning(f"Deployment {namespace}/{name} could not be scaled to "
                    f"{replicas}, reverting to {previous_replicas}.")
        update_deployment_scale(name, namespace, previous_replicas)
Updates a Deployment's scale and waits for cluster state to reconcile.

    Args:
        name: Name of the Deployment.
        namespace: Namespace of the Deployment.
        replicas: Desired number of replicas.
        timeout: Time to wait for reconciliation until failing.

    Raises:
        ReconciliationError:
            The cluster state did not reconcile within timeout.
    
Updates a Deployment's scale and waits for cluster state to reconcile.
Updates a Deployment ' s scale and waits for cluster state to reconcile .
async def scale_deployment(name: str, namespace: str, replicas: int,
                           timeout: timedelta):
    previous_replicas = get_scale_for_deployment(name, namespace)
    update_deployment_scale(name, namespace, replicas)
    try:
        api = client.AppsV1Api()
        predicate = deployment_has_scale(replicas)
        await wait_for_reconciliation(
            predicate,
            timeout,
            api.read_namespaced_deployment,
            name,
            namespace
        )
    except ReconciliationError:
        log.warning(f"Deployment {namespace}/{name} could not be scaled to "
                    f"{replicas}, reverting to {previous_replicas}.")
        update_deployment_scale(name, namespace, previous_replicas)
async def scale_deployment ( name : str , namespace : str , replicas : int , timeout : timedelta ) : previous_replicas = get_scale_for_deployment ( name , namespace ) update_deployment_scale ( name , namespace , replicas ) try : api = client . AppsV1Api ( ) predicate = deployment_has_scale ( replicas ) await wait_for_reconciliation ( predicate , timeout , api . read_namespaced_deployment , name , namespace ) except ReconciliationError : log . warning ( f"Deployment {namespace}/{name} could not be scaled to " f"{replicas}, reverting to {previous_replicas}." ) update_deployment_scale ( name , namespace , previous_replicas )
Updates a Deployment's scale and waits for cluster state to reconcile.
Updates a Deployment ' s scale and waits for cluster state to reconcile .
"""Updates a Deployment's scale and waits for cluster state to reconcile.

    Args:
        name: Name of the Deployment.
        namespace: Namespace of the Deployment.
        replicas: Desired number of replicas.
        timeout: Time to wait for reconciliation until failing.

    Raises:
        ReconciliationError:
            The cluster state did not reconcile within timeout.
    """
The cluster state did not reconcile within timeout.
The cluster state did not reconcile within timeout .
ReconciliationError
name
str
Name of the Deployment.
Name of the Deployment .
namespace
str
Namespace of the Deployment.
Namespace of the Deployment .
replicas
int
Desired number of replicas.
Desired number of replicas .
timeout
timedelta
Time to wait for reconciliation until failing.
Time to wait for reconciliation until failing .