acoustic-van-30942
02/15/2023, 5:38 AMfrom metaflow import S3
import os
with S3(s3root='<s3://metaflow-s3-ampsdemo/test_data/sample_training/>') as s3:
if not os.path.exists('sample_training'):
os.makedirs('sample_training')
res = s3.get_all()
for obj in res:
with open(f'sample_training/{obj.key}', 'w') as f:
f.write(obj.text)acoustic-van-30942
02/15/2023, 5:45 AMmounted_volume within the @batch decorator. Do I need to load in the data within the same task as the task used to load in the model or can it be in a separate task?victorious-lawyer-58417
02/15/2023, 5:56 AMobj.path as long as you are inside the S3 scopeacoustic-van-30942
02/15/2023, 5:59 AMvictorious-lawyer-58417
02/15/2023, 6:37 AMSOURCES = ['s3://.../path1', 's3://.../path2', 's3://.../path3']
sources = []
dirs = []
for src in SOURCES:
s3 = S3(s3root=src)
sources.append(s3)
objs = s3.get_all()
if objs:
dirs.append(os.path.dirname(objs[0].path))
print('do something with data in directories', dirs)
for src in sources:
src.close()
here dirs contain the data downloads from SOURCES. Local copies get deleted in the end when you do src.close()victorious-lawyer-58417
02/15/2023, 6:38 AM@batch, you can't rely on local directories across steps/tasksvictorious-lawyer-58417
02/15/2023, 6:39 AMacoustic-van-30942
02/15/2023, 6:51 AM