Carlos Cueto
10/10/2024, 2:56 PMclient.read_flow_runs()
API... it gives me a pydantic validation error whenever the returned flow run(s) have a "state": { "data": {"type": "unpersisted"} }
property... is this something that was overlooked in development? Not sure how to deal with this:
File "C:\Web Apps\Prefect2.0-Flows\flows\Python\Snowflake\ff_gl_stats_sf_load.py", line 22, in get_completed_flow_runs_with_flow_name
flow_runs = await client.read_flow_runs(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Web Apps\Prefect2.0-Flows\venv\Lib\site-packages\prefect\client\orchestration.py", line 2148, in read_flow_runs
return pydantic.TypeAdapter(List[FlowRun]).validate_python(response.json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Web Apps\Prefect2.0-Flows\venv\Lib\site-packages\pydantic\type_adapter.py", line 135, in wrapped
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Web Apps\Prefect2.0-Flows\venv\Lib\site-packages\pydantic\type_adapter.py", line 366, in validate_python
return self.validator.validate_python(object, strict=strict, from_attributes=from_attributes, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for list[FlowRun]
0.state.data.BaseResult
Value error, Invalid type: unpersisted [type=value_error, input_value={'type': 'unpersisted'}, input_type=dict]
NOTE: This only happens on Prefect 3.0+ version, does not occur on my other work queues that are still in 2.*Isaac
10/14/2024, 9:44 PMrun_deployment
to kick off a separate deployment. Our tasks that don't call this function are working properly. Each time we encounter the issue we get the following two errors as logs to our tasks:
Running `retry_condition_fn` check None for task 'task-name'
Task run failed with exception: 1 validation error for FlowRun
state.data.BaseResult
Value error, Invalid type: unpersisted [type=value_error, input_value={'type': 'unpersisted'}, input_type=dict]
For further information visit <https://errors.pydantic.dev/2.9/v/value_error>
Isaac
10/14/2024, 9:45 PMChris White
Isaac
10/14/2024, 9:53 PMChris White
Isaac
10/14/2024, 9:56 PMChris White
unpersisted
result types entirely without raising an error, but that will require unraveling some of the pydantic machinery so it could go either wayIsaac
10/14/2024, 10:05 PMrun_deployment
is unable to reconcile the unpersisted
type.
For our purposes, as it successfully runs the deployment, we might be able to get away with catching the specific error as a workaround.Chris White
Chris White
Isaac
10/14/2024, 10:09 PMChris White