-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support staticmethod
and classmethod
flow entrypoints
#17892
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
Comments
staticmethod
and classmethod
flow entrypoints
Thanks for opening this, @vyagubov! Adding support for Are you up for giving it a shot? I'm happy to help if you run into any issues. |
I will give it a try. Expect PR on Tuesday (on Monday I am on vacation). |
For However, for I see a few options:
@desertaxle |
Cool! I think you're approach in 3 sounds good and it wouldn't be too big of a change since we have some unused functions. |
Hi @desertaxle! This is ready for review — any feedback is welcome and much appreciated. Thanks! |
Bug summary
I'm using Prefect with static methods defined inside classes and deploying with source code from GitLab using an explicit entrypoint.
My flow is defined like this:
I try to use:
However, Prefect raises an error saying it couldn't find the flow.
Expected Behavior:
Since @flow supports @staticmethod based on the source code here:
prefect/src/prefect/flows.py
Line 281 in 093237b
I expect that specifying ClassName.run in the entrypoint should work.
Root Cause:
In the same file, later in the Flow class, the entrypoint is hardcoded as:
prefect/src/prefect/flows.py
Line 405 in 093237b
This ignores the class context (ClassName) and causes the flow to be inaccessible via the expected entrypoint path.
Current Workaround:
To make this work, I need to add a top-level alias:
Suggested Fix:
Respect the class context in the entrypoint, or allow users to specify ClassName.run explicitly and resolve it correctly during loading.
Version info
Additional context
No response
The text was updated successfully, but these errors were encountered: