-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
step decorators: retry #130
Labels
Projects
Comments
yaythomas
added a commit
that referenced
this issue
Mar 22, 2019
yaythomas
added a commit
that referenced
this issue
Mar 23, 2019
yaythomas
added a commit
that referenced
this issue
Mar 23, 2019
yaythomas
added a commit
to pypyr/pypyr-example
that referenced
this issue
Mar 23, 2019
yaythomas
added a commit
to pypyr/pypyr-example
that referenced
this issue
Mar 23, 2019
yaythomas
added a commit
that referenced
this issue
Mar 24, 2019
yaythomas
added a commit
that referenced
this issue
Mar 24, 2019
yaythomas
added a commit
that referenced
this issue
Mar 24, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add a retry decorator, to allow this:
retry
keeps on looping over step until:Error raises back up to the pypyr core when:
max
exhaustedstopOn
retryOn
is not None and error not inretryOn
retry
should pump an intretryCounter
into context on each retry iteration.retryOn
andstepOn
deserves some thought: how to load exception dynamically - repr strings might well be too limiting input (e.g specific transient err msg that can't be predicted)? what if exception is outside stdlib? Prob just match on name, though this means if you had mymodule.ValueError that would also catch built-in ValueError...Implementation:
prob deserves its own class, similar to WhileDecorator.
pypyr.dsl.RetryDecorator
.can prob borrow the plumbing for
while_until_true(interval, max_attempts)
inpypyr.utils.poll
.prob can do something like:
exec_iteration
contains the catches forretryOn
- log and swallow if any of these, continue exit with False.retry_loop
will do something like this:Rather than raise LoopMaxExhaustedError, raise the step_method error back up to the core if max exhausted.
The execution insertion point should probably be in
invoke_step(self, context)
. Something like this:Note there's a bug here that might as well get fixed while we're here: #129
This means that
retry
happens inside the while and for loops. i.e a step can retry >1 within a single iteration of a while/for loop. Is this a valid assumption, or a good default behaviour? Or would a pipeline author instead expect the retries to be outside the while/for/conditional loops+checks?Credit and thanks to @Reskov for an excellent idea!
The text was updated successfully, but these errors were encountered: