Hi everyone,
I'am using
Prefect version: 3.1.1 and
I’ve been encountering an intermittent issue with my Prefect deployments, and I’m hoping someone can help clarify why this might be happening and how to best address it. Here's the context:
When I execute a deployment, the flow sometimes enters a
Crashed
state. The logs show the following error:
ERROR | prefect.engine - Engine execution of flow run '<run-id>' exited with unexpected exception
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\<temp-folder>\\orchestration\\subflows_definition\\coordinador_downloads.py'
This suggests that the deployment is unable to locate the required file in the temporary directory.
Interestingly, if I restart Prefect (both the Server and Workers) and rerun the same deployment, it executes successfully without issues. Logs for the successful run show:
INFO | Task run 'run_script-f9b' - Successfully ran script ...
INFO | Flow run '<run-id>' - Finished in state Completed()
Why might the flow enter a
Crashed
state with a
FileNotFoundError
for code stored in a temporary directory? Could this be related to my use of
LocalFileSystem
storage on Windows?
What happens during a Prefect restart that resolves the issue? Is it forcing a re-synchronization of the code between the Server and Worker?
Are there best practices or configurations I can apply to prevent this kind of issue in a Windows environment?