<@ULVA73B9P> I'm trying to upgrade from prefect 2.x to 3.0.11 and I'm running into an error when att...
a
@Marvin I'm trying to upgrade from prefect 2.x to 3.0.11 and I'm running into an error when attempting to create a flow run from a deployment id.
Copy code
await client.create_flow_run_from_deployment(deployment_id=deployment.id)
It is raising this error
Copy code
pydantic.errors.PydanticUserError: `StateCreate` is not fully defined; you should define all referenced types, then call `StateCreate.model_rebuild()`.
I appear to be able to replicate the issue by running the following
Copy code
import prefect.states

state = prefect.states.Scheduled()
state.to_state_create()
Is this an existing issue or am I calling the method incorrectly for Prefect 3.0?
m
The error you're encountering may be related to changes in the Prefect 3.x library, especially considering that Prefect 3 is built with Pydantic 2 for improved performance. This affects certain models and may require adjustments if you're using custom Pydantic models or specific Prefect functionalities that were refactored with the new release. Currently, there are no existing issues directly matching the error
PydanticUserError: StateCreate is not fully defined
in the Prefect GitHub repository, which suggests this might be related to changes in how Prefect's state management is handled internally. For handling flow runs and deployment in Prefect 3.0, the method to create flow runs from deployments might slightly differ compared to Prefect 2.x. In Prefect 3.0, deployments are elevated entities with their own API, and handling them might require using updated methods or parameters. Information on running scheduled deployments can be found here in the Prefect documentation. Regarding Pydantic and model changes introduced with Prefect 3, more information about adjustments required for Pydantic 2 can be found in Prefect's upgrade guide. If the error persists, you might want to double-check the specific sections of your code that interact with
StateCreate
or how you transition states using Prefect's new tooling to ensure compatibility with any API changes in the upgrade.