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

create_flow_run_from_deployment breaks with default state parameter for Pydantic >=2.10 #16407

Closed
nithinkrishnamurthi opened this issue Dec 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nithinkrishnamurthi
Copy link

nithinkrishnamurthi commented Dec 16, 2024

Bug summary

If no state variable is provided, Prefect will automatically call prefect.states.Scheduled(). For whatever reason, this function call will result in a model validation error starting in Pydantic 2.10.

Traceback (most recent call last):
File "/home/ubuntu/prefect-poc/perf/test.py", line 153, in
asyncio.run(run_deployments())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/ubuntu/prefect-poc/perf/test.py", line 138, in run_deployments
scheduled_state = prefect.states.Scheduled()
File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/states.py", line 608, in Scheduled
return cls(type=StateType.SCHEDULED, state_details=state_details, **kwargs)
File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/pydantic/main.py", line 214, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/pydantic/_internal/_mock_val_ser.py", line 100, in getattr
raise PydanticUserError(self._error_message, code=self._code)
pydantic.errors.PydanticUserError: State is not fully defined; you should define all referenced types, then call State.model_rebuild().

Version info

Version:             3.1.4
API version:         0.8.4
Python version:      3.10.12
Git commit:          78ee41cb
Built:               Wed, Nov 20, 2024 7:37 PM
OS/Arch:             linux/x86_64
Profile:             local
Server type:         server
Pydantic version:    2.10.0
Integrations:
  prefect-ray:       0.4.3

Additional context

No response

@nithinkrishnamurthi nithinkrishnamurthi added the bug Something isn't working label Dec 16, 2024
@nithinkrishnamurthi nithinkrishnamurthi changed the title create_flow_run_from_deployment breaks with default state parameter for Pydantic >2.10 create_flow_run_from_deployment breaks with default state parameter for Pydantic >=2.10 Dec 16, 2024
@zzstoatzz
Copy link
Collaborator

zzstoatzz commented Dec 16, 2024

hi @nithinkrishnamurthi - thank you for the issue! I'm going to close this as a duplicate of #15957

this is related to #16387


please let us know if you think is not the same issue!

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

No branches or pull requests

2 participants