Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
When building the activity worker, if a registered activity is a plain function whose first parameter is
self, the worker now emits aUserWarning. That almost always means someone passedMyActivities.my_methodinstead ofMyActivities(...).my_method, and today that only shows up later as a confusing failure when the activity runs.It's a warning rather than an error so nothing that currently works (e.g. odd but intentional function signatures) breaks.
Also added a test next to the existing callable-class bad-register test, and a changelog entry under Added.
Why
Closes #377
Checklist
test_workflow_activity_method_unbound_registerintests/worker/test_workflow.py; it fails without the change and passes with it.-k "activity_method or callable_class") and all oftests/worker/test_activity.py, all passing, and confirmed no existing test triggers the new warning.ruff check --select I,ruff format --check, pyright and mypy are clean on the changed files.