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

Refactor: Correct polling infrequent/periodic_sequence usecase #125

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

Conversation

pfranck
Copy link

@pfranck pfranck commented Jul 8, 2024

What was changed

We use the activity.info().attempt value to feed the TestService

Why?

Before this change the attempt value in the TestService was never change and stay to 0

Checklist

  1. How was this tested:
    Run the 2 command explain in the readme - success on 5 atempts

@CLAassistant
Copy link

CLAassistant commented Jul 8, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -13,7 +13,8 @@ class ComposeGreetingInput:

@activity.defn
async def compose_greeting(input: ComposeGreetingInput) -> str:
test_service = TestService()
attempt = activity.info().attempt - 1
test_service = TestService(attempt=attempt)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Seems this was written with a bug.

I think a cleaner approach would be to make this activity a method (and call via execute_activity_method from workflow) and instantiate the TestService as class state.

Also, I think frequent polling is affected by this same test service issue.

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! May need reformat (poe format) and may need to check types (poe lint-types). If you want you can also apply to the other polling test that uses this test service, but no worries if not, we can create another issues.

polling/infrequent/activities.py Outdated Show resolved Hide resolved
polling/test_service.py Outdated Show resolved Hide resolved
@pfranck
Copy link
Author

pfranck commented Jul 8, 2024

poe format and poe lint-types have been runned

@pfranck pfranck changed the title Refactor: Correct polling infrequent usecase Refactor: Correct polling infrequent/periodic_sequence usecase Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants