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

flow.validate_parameters regression #16105

Closed
j-tr opened this issue Nov 25, 2024 · 2 comments · Fixed by #16117
Closed

flow.validate_parameters regression #16105

j-tr opened this issue Nov 25, 2024 · 2 comments · Fixed by #16117
Assignees
Labels
bug Something isn't working

Comments

@j-tr
Copy link
Contributor

j-tr commented Nov 25, 2024

Bug summary

Certain flow deployments that worked fine before cannot be executed anymore after updating from Prefect 2.20.9 to any newer Prefect version.
This is due to a change in the parameter validation.

MRE:

from prefect import flow

@flow
def my_flow(param: dict[str, str]):
    pass

flow_run_params = {
    "param": {'foo': 'bar'}
}

my_flow.validate_parameters(flow_run_params)

runs fine for Prefect <= 2.20.9.

But raises

Traceback (most recent call last):
  File "mre.py", line 13, in <module>
    my_flow.validate_parameters(flow_run_params)
  File "mre.py", line 532, in validate_parameters
    has_v1_models = any(
  File "mre.py", line 533, in <genexpr>
    issubclass(param.annotation, V1BaseModel)
  File "/usr/lib/python3.10/abc.py", line 123, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class

for Prefect >= 2.20.10

Version info

Version:             2.20.14
API version:         0.8.4
Python version:      3.10.12
Git commit:          fb919c67
Built:               Mon, Nov 18, 2024 4:41 PM
OS/Arch:             linux/x86_64
Server type:         cloud

Additional context

related to #15608

@j-tr j-tr added the bug Something isn't working label Nov 25, 2024
@zzstoatzz
Copy link
Collaborator

zzstoatzz commented Nov 26, 2024

hi @j-tr - thanks for the issue!

can you share what version of pydantic you are using? I cannot seem to directly reproduce this

In [1]: from prefect import flow
   ...:
   ...: @flow
   ...: def my_flow(param: dict[str, str]):
   ...:     pass
   ...:
   ...: flow_run_params = {
   ...:     "param": {'foo': 'bar'}
   ...: }
   ...:
   ...: my_flow.validate_parameters(flow_run_params)

Out[1]: {'param': {'foo': 'bar'}}

In [2]:

In [2]: !uv pip list | rg 'prefect|pydantic'
prefect                             2.20.14                           /Users/nate/github.com/prefecthq/prefect
pydantic                            2.10.2
pydantic-core                       2.27.1

EDIT: interesting, ok I reproduce it on python 3.10...

@zzstoatzz
Copy link
Collaborator

thanks @j-tr - this should be fixed by the above PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants