flower
flower copied to clipboard
Augment `Driver` class with error handling via `RetryInvoker`
- Added a sync lock for Driver API calls in the
Driverclass to prevent potential thread conflicts - Wrapped all Driver API calls within
RetryInvoker. - Added new unit tests in
driver/driver_test.py
The default RetryInvoker for the Driver class is configured as follows.
err_codes = (StatusCode.UNAVAILABLE,)
RetryInvoker(
exponential,
RpcError,
max_tries=10,
max_time=300,
should_giveup=lambda e: e.code() not in err_codes,
)