Skip to content

Fix "retry" in simpleflow History #425

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jbbarth
Copy link
Collaborator

@jbbarth jbbarth commented Sep 3, 2023

This PR is based on #423, so please only review the last 2 commits (I wish I had a better way to do that, see #424)

The "retry" count in simpleflow's History model is wrong:

  • 1/ it's set at the end of each activity, when failing or timing out, so it has a wrong value during executions
  • 2/ it's set to "0" when a task fails or times out, which means it's off by one (if a task fails then succeeds, "retry" is at "0" instead of "1")

This PR:

  • (first commit) fixes the two issues by setting it at "schedule" time for activities (and "start_initiating" time for child workflows)
  • (second commit) adds a "attempts" key to materialise attempts ; tbh I would drop "retry" and keep that one only, as I find it clearer to understand ; that's the wording AWS SDKs use fwiw ; but we can decide to drop this second commit if you prefer

@ewjoachim
Copy link
Contributor

It's sure that it would be nice if we didn't have to keep to equivalent properties. I guess there might be a way to only keep a single value and use getter/setters to expose the other one. But it's probably going to be highly overengineered compared to your solution. It's just that I'm afraid we may end up in cases where they're out of sync, especially if there's client code interacting with those.

So I'd say OK, but I think we'll may need to change details here and there in our own code in relation to this. I'd suggest we do this in a different release, after the boto thing.

@jbbarth
Copy link
Collaborator Author

jbbarth commented Sep 8, 2023

@ewjoachim honestly I would keep only "attempts" as it's semantically clearer than "retry", BUT I'm afraid of breaking in some usages. If you're not afraid of breaking (I know for a fact it's not used in Webflow, and I doubt you use the history in the Botify codebase...) we can get rid of it?

Also we used to love dicts, I agree that some dataclasses with more intelligent serialisation would be great.

@@ -155,6 +155,8 @@ def get_activity():
"decision_task_completed_event_id": event.decision_task_completed_event_id,
}
if event.activity_id not in self._activities:
activity["retry"] = 0
activity["attempt"] = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could use the attempt_number name, as in simpleflow.task.TaskFailureContext?
And update this class not to use retry? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants