Poll DescribeTable until the table reaches ACTIVE status.
(client, table_name: str, timeout: float = 30.0)
| 68 | # --------------------------------------------------------------------------- |
| 69 | |
| 70 | def wait_for_active(client, table_name: str, timeout: float = 30.0) -> None: |
| 71 | """Poll DescribeTable until the table reaches ACTIVE status.""" |
| 72 | deadline = time.monotonic() + timeout |
| 73 | while time.monotonic() < deadline: |
| 74 | resp = client.describe_table(TableName=table_name) |
| 75 | status = resp["Table"]["TableStatus"] |
| 76 | if status == "ACTIVE": |
| 77 | print(f" ✓ {table_name} is ACTIVE") |
| 78 | return |
| 79 | time.sleep(0.3) |
| 80 | raise TimeoutError(f"{table_name} did not become ACTIVE within {timeout}s") |
| 81 | def section(title: str) -> None: |
| 82 | """Print a section header.""" |
| 83 | print(f"\n{'='*60}") |
no test coverage detected