Morning all, I have a deployment scheduled which s...
# ask-community
a
Morning all, I have a deployment scheduled which seems to be working majority of the time, but randomly sometimes it'll fail with the below error. I'm struggling to understand why the file/directory wouldn't exist when the same flow is working fine at other times. Any suggestions on where to start?
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/prefect/engine.py", line 276, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.8/dist-packages/prefect/client/utilities.py", line 40, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/prefect/deployments.py", line 195, in load_flow_from_flow_run
await storage_block.get_directory(from_path=deployment.path, local_path=".")
File "/usr/local/lib/python3.8/dist-packages/prefect/filesystems.py", line 147, in get_directory
copytree(from_path, local_path, dirs_exist_ok=True)
File "/usr/lib/python3.8/shutil.py", line 557, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File "/usr/lib/python3.8/shutil.py", line 513, in _copytree
raise Error(errors)
shutil.Error: [('/home/user/.prefect/prefect.db-shm', '/tmp/tmp791im88hprefect/.prefect/prefect.db-shm', "[Errno 2] No such file or directory: '/home/user/.prefect/prefect.db-shm'")]
f
I don't have any hint about this error, but I would recommand to switch to postgres if it's for production
even for local dev booting a psql container isn't bad
a
Just development environment atm, but definitely something I'll look into. Thanks
f
sound like the temp folder is deleted before getting copied as prefect.db-shm
something else is deleting this folder
could be the OS, a cleaning app, a cleaning routine, ect
a
Does Prefect delete the tmp folders after the flow run has completed?
I noticed the tmp folders were including the whole folder including a lot of vscode-plugins and thought that strange, as it takes up a lot of memory. I changed the upcoming schedules to be a maximum of 10 to stop it creating many tmp folders
f
idk, according to the paths you are on linux right ?
not a container ?
a
correct
f
you could look at auditctl tools
it permit to track what change files/folders
it will tell you as example what folder was deleted by what process in /tmp
but it's probably overthinking 😅
but anyway if you are curious you could take a look at
a
Great, will take a look 🙂 I'm thinking maybe I can change the local storage to be something other than tmp, if it is indeed something clearing out tmp folders before prefect can access
f
not sure, prefect probably use tempfile stdlib
a
I will attempt postgres first as that seems to be the best practice!
Thanks again for the help