Robin
12/14/2024, 10:03 PMDaskTaskRunner
but got the following error:
pydantic_core._pydantic_core.PydanticSerializationError: Error calling function `ser_model`: AttributeError: 'NullFileSystem' object has no attribute 'get_block_type_slug'
What could that cryptic error message mean?Nate
12/15/2024, 4:27 PMRobin
12/15/2024, 4:37 PMNate
12/15/2024, 4:40 PMRobin
12/15/2024, 4:42 PMcache_policy=NONE
?Robin
12/15/2024, 4:42 PMNate
12/15/2024, 4:43 PMRobin
12/15/2024, 4:44 PMRobin
12/15/2024, 4:46 PMNate
12/15/2024, 4:48 PMRobin
12/15/2024, 4:49 PMRobin
12/15/2024, 4:49 PMcache_policy=None
in every task and see if that helpsNate
12/15/2024, 4:50 PMNONE
not the python builtin None
(though I can see how this would be confusing and we should probably accept either to mean the same thing)Robin
12/15/2024, 4:53 PM@flow(task_runner=dask)
def flow_a():
for id in ids:
flow_run_task.submit()
@task(cache_policy=None)
flow_run_task(kwargs):
flow_b(kwargs)
@flow(task_runner=not_dask)
def flow_b():
do_something()
do_something_else()
@task()
def do_something():
...
@task()
def do_something_else()
...
Robin
12/15/2024, 4:54 PMjust to avoid any confusion, it is an importable constant valueThat explains why my linter is complaining 🙈not the python builtinNONE
(though I can see how this would be confusing and we should probably accept either to mean the same thing)None
Robin
12/15/2024, 4:55 PMNONE
from? Seems to miss in the docs 🤔Robin
12/15/2024, 4:55 PMfrom prefect.cache_policies import NONE
?Nate
12/15/2024, 4:56 PMRobin
12/15/2024, 6:40 PMcache_policy=None
did not prohibit the error 🤔Robin
12/15/2024, 6:41 PMRobin
12/15/2024, 6:42 PMRobin
12/15/2024, 6:52 PMRobin
12/15/2024, 6:54 PM18:51:24.455 | ERROR | Flow run 'polar-basilisk' - Finished in state Failed("Flow run encountered an exception: PydanticSerializationError: Error calling function `ser_model`: AttributeError: 'NullFileSystem' object has no attribute 'get_block_type_slug'")
Traceback (most recent call last):
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/blocks/core.py", line 354, in ser_model
"block_type_slug": self.get_block_type_slug(),
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/pydantic/main.py", line 811, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'NullFileSystem' object has no attribute 'get_block_type_slug'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ubuntu/code/.../flow.py", line 104, in <module>
run_emulations(
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flows.py", line 1346, in __call__
return run_flow(
^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flow_engine.py", line 1493, in run_flow
return run_flow_sync(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flow_engine.py", line 1373, in run_flow_sync
return engine.state if return_type == "state" else engine.result()
^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flow_engine.py", line 347, in result
raise self._raised
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flow_engine.py", line 759, in run_context
yield self
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flow_engine.py", line 1371, in run_flow_sync
engine.call_flow_fn()
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/flow_engine.py", line 782, in call_flow_fn
result = call_with_parameters(self.flow.fn, self.parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/utilities/callables.py", line 208, in call_with_parameters
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.../flow.py", line 87, in run_emulations
run_emulation.submit(
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/tasks.py", line 1179, in submit
future = task_runner.submit(self, parameters, wait_for)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect_dask/task_runners.py", line 353, in submit
future = self._client.submit(
^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect_dask/client.py", line 35, in submit
run_task_kwargs["context"] = serialize_context()
^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/context.py", line 78, in serialize_context
"flow_run_context": flow_run_context.serialize() if flow_run_context else {},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/prefect/context.py", line 373, in serialize
return self.model_dump(
^^^^^^^^^^^^^^^^
File "/home/ubuntu/code/core/.venv/lib/python3.12/site-packages/pydantic/main.py", line 347, in model_dump
return self.__pydantic_serializer__.to_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.PydanticSerializationError: Error calling function `ser_model`: AttributeError: 'NullFileSystem' object has no attribute 'get_block_type_slug'
Robin
12/16/2024, 9:10 AMAttributeError... NullFileSystem
downgrade prefect to prefect==3.1.5
⚠️
The above error is now also raised locally.
I changed back to prefect==3.1.5
and the error disappears.
I suggest you add an integration test to run a simplified flow like above.
I may have the time later today to implement a PR that contains the failing flows as minimal reproducible exampleRobin
12/16/2024, 9:12 AMNate
12/16/2024, 4:59 PMJosiah Reeves
01/13/2025, 8:45 PMNate
01/13/2025, 9:06 PMJosiah Reeves
01/13/2025, 9:07 PMNate
01/13/2025, 9:47 PM