Closed Bug 732641 Opened 13 years ago Closed 13 years ago

Implement @retriable decorator to simplify usage of retry()

Categories

(Release Engineering :: General, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rail, Assigned: rail)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch retriable (obsolete) — Splinter Review
Sometimes it's hard to read the code wrapped with retry() function, especially if you want to pass just one parameter: retry(func, args=(foo,), retry_exceptions=(MyError,), ...) Sometimes it's simpler to make a function retriable always and call it directly: @retriable(retry_exceptions=(MyError,)) def func(foo): ... func(foo) Initial implementation with tests attached.
Attachment #602546 - Flags: review?(bhearsum)
Attachment #602546 - Flags: review?(bhearsum) → review+
Attached patch retriable (obsolete) — Splinter Review
It turned out that I prepared the patch against an old tools repo. :/ Refreshed patch sleeptime explicitly set to 0. No changes in retry.py.
Attachment #602546 - Attachment is obsolete: true
Attachment #603342 - Flags: review?(bhearsum)
Attachment #603342 - Flags: review?(bhearsum) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Python 2.5 failed: Traceback (most recent call last): File "e:/builds/moz2_slave/m-in-w32/tools/buildfarm/utils/retry.py", line 16, in <module> from util.retry import retry File "e:/builds/moz2_slave/m-in-w32/tools/buildfarm/utils\../../lib/python\util\retry.py", line 57 return retry(func, *retry_args, args=args, kwargs=kwargs, ^ SyntaxError: invalid syntax Ben backed out the patches.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #603342 - Flags: checked-in+ → checked-in-
Attached patch retriableSplinter Review
I changed the order of arguments being passed to retry() to be compatible with python 2.5 (1 liner change). Unit tests have passed python 2.6.5 (linux build slave), 2.7.2 (my laptop) and 2.5 (Windows build slave).
Attachment #603342 - Attachment is obsolete: true
Attachment #607144 - Flags: review?(bhearsum)
Attachment #607144 - Flags: review?(bhearsum) → review+
Looks like it worked properly this time.
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Product: mozilla.org → Release Engineering
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: