I’m trying to restore previous run that was execut...
# ask-metaflow
l
I’m trying to restore previous run that was executed on K8s.
Copy code
from metaflow import Run
run = Run('DatabaseAndS3Test/229')
print(run.tags)
mycode = Run('DatabaseAndS3Test/229').code
print(mycode.path)
run.code.extract(path='~/_nasHome/tools/restore')
This code gives me an error AttributeError: ‘MetaflowCode’ object has no attribute ‘extract’ Any ideas on what am I doing wrong?
1
v
try adding
tarball
Copy code
run.code.tarball.extract(path='~/_nasHome/tools/restore')
l
I did look at the doc and that’s how I got my example. Maybe I’m missing some background. When I try tarball there is no error but nothing is extracted in to the folder.
Copy code
from metaflow import Run
run = Run('DatabaseAndS3Test/229')
print(run.tags)
mycode = Run('DatabaseAndS3Test/229').code
print(mycode.path)
mycode.tarball.extractall(path='~/_nasHome/tools/restore/file.tar.gz')
Output looks like this
Copy code
frozenset({'python_version:3.10.8', 'metaflow_version:2.7.20', 'user:ff_alex', 'Testing-Metaflow', 'runtime:dev'})
<s3://metaflow/metaflow/DatabaseAndS3Test/data/7a/7a7fcdd5893651e5ba5e375b0a8e06474f6ad7b3>
When I browse to the bucket I do see the file as expected. We store data on minio, is that normal that path states s3?
v
when you do
mycode.tarball.extractall
the
path
attribute refers to the directory where you want to unpack the files. Hence you don't need to specify
file.tar.gz
there. Try e.g.
mycode.tarball.extractall(path='/tmp/mycode_test/')
and then see the files at
/tmp/mycode_test/
- if there's no error, the files should appear there
l
Thank you, it worked! The problem was with relative path from home folder, had to specify full path.
👍 1