narrow-garden-54875
07/10/2024, 8:09 PMMETAFLOW_CLIENT_CACHE_PATH
env var to cache s3 files "locally" (from a databricks notebook - though I don't think being on databricks matters here). When we execute this code:
os.environ['METAFLOW_CLIENT_CACHE_PATH'] = './tmp'
runs = list(Flow('MyFlow').runs(TAG))
runs[0].data.run_results
We get the error:
FileNotFoundError: [Errno 2] No such file or directory: '/Workspace/Users/<me>/tmp/s3.s3:/my-s3-bucket.MyFlow/2b/dlobj1sb8hqy3' -> './tmp/<s3.s3://my-s3-bucket.MyFlow/2b/2b19368886545832ce20692d56e4e9285627674b.blob>'
File <command-1625965594877807>, line 1
----> 1 run.data.run_results
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.10/site-packages/metaflow/client/filecache.py:270, in FileCache.create_file(self, path, value)
268 tmpfile.write(value)
269 tmpfile.flush()
--> 270 os.rename(tmpfile.name, path)
271 except: # noqa E722
272 os.unlink(tmpfile.name)
My understanding is this is an issue with the create_file
method in the filecache.py file itself (here):
It seems metaflow is creating that temp cached file and trying to save it to a directory locally, but calls os.path.dirname
on the input first which gives us the ./tmp/<s3.s3://my-s3-bucket.MyFlow/2b>
path we're seeing in our databricks workspace. Then it tries to save the file to the same path, but never calls the os.path.dirname
method on our s3 path, so it ends up being a malformed dir structure and the temp file gets deleted (lines 267-270).
Wondering if you've seen this before / if there's a way to get around it?narrow-garden-54875
07/11/2024, 2:59 PMmetaflow.s3.hash
path - wondering why ours is an unformatted s3 path?ancient-application-36103
07/11/2024, 9:59 PMnarrow-garden-54875
07/12/2024, 1:12 PM/tmp
isn't really possible. Setting the cache path to the full path /Workspace/Users/<me>/tmp
leads to the same error. We also are setting the env var before importing metaflow.narrow-garden-54875
07/16/2024, 7:45 PMancient-application-36103
07/16/2024, 7:50 PMnarrow-garden-54875
07/23/2024, 4:13 PMdry-beach-38304
07/23/2024, 9:43 PMcreate_file
is being called from store_key
from line 426 (from the FileBlobCache
. This should ideally be called from here and the key there should ideally not include the s3 portion so I suspect something may be going wrong higher up. If you have a more detailed traceback (and even better, values for the parameters passed to the functions), that would be helpful in understanding where the issue may be coming from. It should definitely not work like this (clearly) but I am not convinced the issue is coming from the filecache atm.narrow-garden-54875
07/24/2024, 6:20 PM