|
| 1 | +from typing import Awaitable, Callable, Optional |
| 2 | + |
| 3 | +from ..polling import poll_until_terminal_status, poll_until_terminal_status_async |
| 4 | + |
| 5 | + |
| 6 | +def poll_job_until_terminal_status( |
| 7 | + *, |
| 8 | + operation_name: str, |
| 9 | + get_status: Callable[[], str], |
| 10 | + is_terminal_status: Callable[[str], bool], |
| 11 | + poll_interval_seconds: float, |
| 12 | + max_wait_seconds: Optional[float], |
| 13 | + max_status_failures: int, |
| 14 | +) -> str: |
| 15 | + return poll_until_terminal_status( |
| 16 | + operation_name=operation_name, |
| 17 | + get_status=get_status, |
| 18 | + is_terminal_status=is_terminal_status, |
| 19 | + poll_interval_seconds=poll_interval_seconds, |
| 20 | + max_wait_seconds=max_wait_seconds, |
| 21 | + max_status_failures=max_status_failures, |
| 22 | + ) |
| 23 | + |
| 24 | + |
| 25 | +async def poll_job_until_terminal_status_async( |
| 26 | + *, |
| 27 | + operation_name: str, |
| 28 | + get_status: Callable[[], Awaitable[str]], |
| 29 | + is_terminal_status: Callable[[str], bool], |
| 30 | + poll_interval_seconds: float, |
| 31 | + max_wait_seconds: Optional[float], |
| 32 | + max_status_failures: int, |
| 33 | +) -> str: |
| 34 | + return await poll_until_terminal_status_async( |
| 35 | + operation_name=operation_name, |
| 36 | + get_status=get_status, |
| 37 | + is_terminal_status=is_terminal_status, |
| 38 | + poll_interval_seconds=poll_interval_seconds, |
| 39 | + max_wait_seconds=max_wait_seconds, |
| 40 | + max_status_failures=max_status_failures, |
| 41 | + ) |
0 commit comments