Skip to content
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

Retry decorator not supports substitution at max #207

Closed
Reskov opened this issue Dec 14, 2020 · 1 comment · Fixed by #208 or #211
Closed

Retry decorator not supports substitution at max #207

Reskov opened this issue Dec 14, 2020 · 1 comment · Fixed by #208 or #211
Assignees
Labels
bug type: decorator step decorators

Comments

@Reskov
Copy link
Collaborator

Reskov commented Dec 14, 2020

Seems like retry_decorator does not happy with dynamic context values that need substitution

steps:
  - name: pypyr.steps.py
    retry:
      max: !py '3'
    in:
      pycode: 'raise ValueError("booom!")'

Will produce

retry: ignoring error because retryCounter < max.
ValueError: booom!
retry: ignoring error because retryCounter < max.
ValueError: booom!
retry: ignoring error because retryCounter < max.
ValueError: booom!

Contrary to original which works well

steps:
  - name: pypyr.steps.py
    retry:
      max: 3
    in:
      pycode: 'raise ValueError("booom!")'
retry: ignoring error because retryCounter < max.
ValueError: booom!
retry: ignoring error because retryCounter < max.
ValueError: booom!
Error while running step pypyr.steps.py at pipeline yaml line: 2, col: 5
Something went wrong. Will now try to run on_failure.

The cause:
On the exec_iteration we are still checking self.max which has a raw value

if counter == self.max:

max = context.get_formatted_as_type(self.max, out_type=int)

Can we support for substitution on the max property?

@yaythomas
Copy link
Member

Excellent, great find! Thank you so much!

@yaythomas yaythomas added this to To do in pypyr roadmap via automation Dec 14, 2020
@yaythomas yaythomas added bug type: decorator step decorators labels Dec 14, 2020
@yaythomas yaythomas assigned yaythomas and Reskov and unassigned yaythomas Dec 14, 2020
pypyr roadmap automation moved this from To do to Done Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type: decorator step decorators
Projects
pypyr roadmap
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants