You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2016/11/21 21:40:56 UTC
[1/2] incubator-beam git commit: Add missing fields to the retry
decorator
Repository: incubator-beam
Updated Branches:
refs/heads/python-sdk 8e88c7b03 -> 50afc87cd
Add missing fields to the retry decorator
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/88d4da43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/88d4da43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/88d4da43
Branch: refs/heads/python-sdk
Commit: 88d4da43b1acb5098cf40c453bc1ac4fb25f2ca7
Parents: 8e88c7b
Author: Sourabh Bajaj <so...@google.com>
Authored: Mon Nov 21 11:28:56 2016 -0800
Committer: Davor Bonaci <da...@google.com>
Committed: Mon Nov 21 13:40:41 2016 -0800
----------------------------------------------------------------------
sdks/python/apache_beam/utils/retry.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/88d4da43/sdks/python/apache_beam/utils/retry.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/retry.py b/sdks/python/apache_beam/utils/retry.py
index b3016fd..3874c7a 100644
--- a/sdks/python/apache_beam/utils/retry.py
+++ b/sdks/python/apache_beam/utils/retry.py
@@ -117,7 +117,7 @@ def no_retries(fun):
def with_exponential_backoff(
num_retries=16, initial_delay_secs=5.0, logger=logging.warning,
retry_filter=retry_on_server_errors_filter,
- clock=Clock(), fuzz=True):
+ clock=Clock(), fuzz=True, factor=2, max_delay_secs=60 * 60 * 4):
"""Decorator with arguments that control the retry logic.
Args:
@@ -134,6 +134,11 @@ def with_exponential_backoff(
use time.sleep().
fuzz: True if the delay should be fuzzed (default). During testing False
can be used so that the delays are not randomized.
+ factor: The exponential factor to use on subsequent retries.
+ Default is 2 (doubling).
+ max_delay_sec: Maximum delay (in seconds). After this limit is reached,
+ further tries use max_delay_sec instead of exponentially increasing
+ the time. Defaults to 4 hours.
Returns:
As per Python decorators with arguments pattern returns a decorator
@@ -155,7 +160,8 @@ def with_exponential_backoff(
def wrapper(*args, **kwargs):
retry_intervals = iter(
FuzzedExponentialIntervals(
- initial_delay_secs, num_retries, fuzz=0.5 if fuzz else 0))
+ initial_delay_secs, num_retries, factor,
+ fuzz=0.5 if fuzz else 0, max_delay_secs=max_delay_secs))
while True:
try:
return fun(*args, **kwargs)
[2/2] incubator-beam git commit: This closes #1396
Posted by da...@apache.org.
This closes #1396
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/50afc87c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/50afc87c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/50afc87c
Branch: refs/heads/python-sdk
Commit: 50afc87cd0d9418c1a7e915521859aebe3339d4a
Parents: 8e88c7b 88d4da4
Author: Davor Bonaci <da...@google.com>
Authored: Mon Nov 21 13:40:47 2016 -0800
Committer: Davor Bonaci <da...@google.com>
Committed: Mon Nov 21 13:40:47 2016 -0800
----------------------------------------------------------------------
sdks/python/apache_beam/utils/retry.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------