Skip to content

wait_until_portal_not_exists

wait_until_portal_not_exists(
    portal_id: ID,
    *,
    max_wait_time: float,
    min_delay: float = 3,
    max_delay: float = 120,
    config_overrides: Optional[IoTSiteWiseClientConfig] = None,
) -> ServiceError

Wait for portal_not_exists.

Parameters:

  • portal_id (ID) –

    The ID of the portal.

  • max_wait_time (float) –

    Maximum total seconds to wait before raising WaiterTimeoutError.

  • min_delay (float, default: 3 ) –

    Minimum seconds between operation attempts (spec default 2).

  • max_delay (float, default: 120 ) –

    Maximum seconds between operation attempts (spec default 120).

Source code in docs_src/capo_iotsitewise/_services/io_t_site_wise.py
def wait_until_portal_not_exists(
    self,
    portal_id: "capo_iotsitewise.types.id.ID",
    *,
    max_wait_time: float,
    min_delay: float = 3,
    max_delay: float = 120,
    config_overrides: Optional[IoTSiteWiseClientConfig] = None,
) -> ServiceError:
    """Wait for portal_not_exists.

    Args:
        portal_id: <p>The ID of the portal.</p>
        max_wait_time: Maximum total seconds to wait before raising WaiterTimeoutError.
        min_delay: Minimum seconds between operation attempts (spec default 2).
        max_delay: Maximum seconds between operation attempts (spec default 120).
    """
    start = time.monotonic()
    attempt = 0
    while True:
        op_output: "capo_iotsitewise.types.describe_portal_response.DescribePortalResponse | None" = None
        op_error: ServiceError | None = None
        try:
            op_output = self.describe_portal(  # noqa: F841
                portal_id, config_overrides=config_overrides
            )
        except ServiceError as e:
            op_error = e
        if op_error is not None and op_error.code == "ResourceNotFoundException":
            return op_error
        elif op_error is not None:
            raise op_error

        elapsed = time.monotonic() - start
        remaining = max_wait_time - elapsed
        if remaining <= 0:
            raise WaiterTimeoutError("portal_not_exists", max_wait_time)
        delay = min(max_delay, min_delay * (2**attempt))
        delay = random.uniform(min_delay, delay)
        delay = min(delay, remaining)
        time.sleep(delay)
        attempt += 1