You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is pretty niche- in my project , I assemble prefect flows dynamically based on some user provided configuration- this works via a common object which provides a call method, which individual tasks all subclass from- these are registered with flow(). A master "Pipeline" object follows the same pattern to actually call these flows in order to produce the This worked fine previously, but upon upgrading to prefect 2.20.3, I'm encountering a new error:
File "/Users/pgulley/Projects/system-metrics/venv/lib/python3.12/site-packages/prefect/tasks.py", line 145, in _generate_task_key h[:NUM_CHARS_DYNAMIC_KEY] if (h := hash_objects(fn.__code__)) else "unknown" ^^^^^^^^^^^ AttributeError: type object 'Pipeline' has no attribute '__code__'. Did you mean: '__doc__'?
This is new as of this update- so I'm not sure what's changed, but it's clear that it has to do with this funny, maybe off-label approach I've taken (as objects don't have a code method like functions do)
Prefect version yeilds:
Version: 2.14.20
API version: 0.8.4
Python version: 3.11.9
Git commit: 8ceb0962
Built: Thu, Feb 1, 2024 6:30 PM
OS/Arch: darwin/arm64
Profile: default
Server type: cloud
But in my venv I have prefect 2.20.3 running
Additional context
No response
The text was updated successfully, but these errors were encountered:
Thanks for the issue @pgulley and for the research you did for it! You're correct that it's definitely related to that issue - I think it was this PR specifically that triggered the problem for you.
I'm glad you have a workaround for now, but we'll also definitely get a fix for this. In fact I have an idea: can you confirm that the following attribute access works for you:
I believe class call methods have the code object that we use for functions, so a more nuanced check of whether the fn is a true function or a callable should allow us to access it without error.
Bug summary
This is pretty niche- in my project , I assemble prefect flows dynamically based on some user provided configuration- this works via a common object which provides a call method, which individual tasks all subclass from- these are registered with flow(). A master "Pipeline" object follows the same pattern to actually call these flows in order to produce the This worked fine previously, but upon upgrading to prefect 2.20.3, I'm encountering a new error:
File "/Users/pgulley/Projects/system-metrics/venv/lib/python3.12/site-packages/prefect/tasks.py", line 145, in _generate_task_key h[:NUM_CHARS_DYNAMIC_KEY] if (h := hash_objects(fn.__code__)) else "unknown" ^^^^^^^^^^^ AttributeError: type object 'Pipeline' has no attribute '__code__'. Did you mean: '__doc__'?
This is new as of this update- so I'm not sure what's changed, but it's clear that it has to do with this funny, maybe off-label approach I've taken (as objects don't have a code method like functions do)
(Related, I think, to this issue: #12340)
Version info (
prefect version
output)Additional context
No response
The text was updated successfully, but these errors were encountered: