waiter#
- class aws_dynamodb_io.waiter.Waiter(delays: Union[int, float], timeout: Union[int, float], instant: bool = False, indent: int = 0, verbose: bool = True)[source]#
Simple retry / polling with progressing status. Usage, it is common to check if a long-running job is done every X seconds and timeout in Y seconds. This class allow you to customize the polling interval and timeout,.
Example:
print("before waiter") for attempt, elapse in Waiter( delays=1, timeout=10, verbose=True, ): # check if should jump out of the polling loop if elapse >= 5: print("") break print("after waiter")
- Parameters:
delays – delay between each check
timeout – timeout in seconds
instant – if True, then the first check is instant
indent – indent level for logging
verbose – whether to print log
Changed in version 0.2.1: add instant parameter to make the first check instant