I encountered some error when automating/scheduling a prefect flow. In my scenario, I install prefect on a python virtual environment using venv, I put this virtual environment in C:/ drive. The prefect flow and deployment.yaml is on another drive (D:/ drive).
I use this scenario because the prefect home directory absolute paths contain a white space and I got some error when installing the virtual environment on the same path as the prefect home.
I deploy the flow for about a week, and it’s doing the job with no error. Recently, I got this error, I suspect this error is about writing the logs to the sqlite database.
Can you guys help me with this? Because this flow is already on production and we can’t deal with unexpected error like this
Below is the error message for this flow run failed
Downloading flow code from storage at 'D:\\PREFECT \\HOME\\DIRECTORY'
06:00:00 AM
prefect.flow_runs
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "C:\PYTHON_VIRTUAL_ENVIRONMENT\DIRECTORY\Documents\prefect_ENV_PRD\env\Lib\site-packages\prefect\engine.py", line 318, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PYTHON_VIRTUAL_ENVIRONMENT\DIRECTORY\Documents\prefect_ENV_PRD\env\Lib\site-packages\prefect\client\utilities.py", line 40, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PYTHON_VIRTUAL_ENVIRONMENT\DIRECTORY\Documents\prefect_ENV_PRD\env\Lib\site-packages\prefect\deployments.py", line 197, in load_flow_from_flow_run
await storage_block.get_directory(from_path=deployment.path, local_path=".")
File "C:\PYTHON_VIRTUAL_ENVIRONMENT\DIRECTORY\Documents\prefect_ENV_PRD\env\Lib\site-packages\prefect\filesystems.py", line 147, in get_directory
copytree(from_path, local_path, dirs_exist_ok=True)
File "C:\Program Files\Python311\Lib\shutil.py", line 561, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\shutil.py", line 515, in _copytree
raise Error(errors)
shutil.Error: [('D:\\PREFECT \\HOME\\DIRECTORY\\home\\prefect.db-shm', 'C:\\PYTHON_VIRTUAL_ENVIRONMENT\\DIRECTORY\\AppData\\Local\\Temp\\tmpymczar64prefect\\home\\prefect.db-shm', "[Errno 2] No such file or directory: 'D:\\\\PREFECT \\\\HOME\\\\DIRECTORY\\\\home\\\\prefect.db-shm'"), ('D:\\PREFECT \\HOME\\DIRECTORY\\home\\prefect.db-wal', 'C:\\PYTHON_VIRTUAL_ENVIRONMENT\\DIRECTORY\\AppData\\Local\\Temp\\tmpymczar64prefect\\home\\prefect.db-wal', "[Errno 2] No such file or directory: 'D:\\\\PREFE CT\\\\HOME\\\\DIRECTORY\\\\home\\\\prefect.db-wal'")]
06:00:08 AM
prefect.flow_runs