Giacomo Chiarella
01/29/2025, 6:27 AMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 154, in run_steps
step_output = await run_step(step, upstream_outputs)
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 124, in run_step
step_func = _get_function_for_step(fqn, requires=keywords.get("requires"))
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 74, in _get_function_for_step
step_func = import_object(fully_qualified_name)
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 216, in import_object
module = load_module(module_name)
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 183, in load_module
working_directory = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/engine.py", line 427, in retrieve_flow_then_begin_flow_run
else await load_flow_from_flow_run(
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/client/utilities.py", line 100, in with_injected_client
return await fn(*args, **kwargs)
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 307, in load_flow_from_flow_run
output = await run_steps(deployment.pull_steps)
File "/home/prefect/prefect_venv/lib/python3.10/site-packages/prefect/deployments/steps/core.py", line 182, in run_steps
raise StepExecutionError(f"Encountered error while running {fqn}") from exc
prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect.deployments.steps.pull_with_block
which looks like random. Do you know what is it? Is there a fix? Unfortunately, when this error happens Prefect is not able to retry because this happens before the flow run code is loaded (looks like Prefect does not even know it needs to retry). If there is no fix, is there a way to make Prefect retry? From what I’ve seen the only way is to create another deployment which retriggers failed flow runs (assuming it is possible to know if a flow run failed because of this error of because of errors during the execution, in the last case the flow run should not be retriggered)