acoustic-van-30942
10/05/2023, 5:58 PMuse_tmpfs?
I tried using it in hopes that it would speed up s3 downloads, but didn't see any significant improvement. How big does the dataset have to be to see gains?acoustic-van-30942
10/05/2023, 5:58 PMfrom metaflow import FlowSpec, step, batch, retry, card, current, S3
class DataProcessingFlow(FlowSpec):
@step
def start(self):
self.next(self.load_data)
@batch(memory=30000, use_tmpfs=True)
@step
def load_data(self):
import time
start = time.time()
with S3(s3root="<s3://my_bucket/test/sample_image_files/>") as s3:
res = s3.get_all()
total_size = sum([obj.size for obj in res])
print(total_size)
print(time.time() - start)
self.next(self.end)
@step
def end(self):
pass
if __name__ == "__main__":
DataProcessingFlow()victorious-lawyer-58417
10/05/2023, 6:08 PM@batch on the fly.
Say, you want to load 128GB of data, you have 20GB of disk, and 200GB of RAM. The data can fit in RAM but without use_tmpfs it'd annoyingly fail due to running out of disk spacevictorious-lawyer-58417
10/05/2023, 6:09 PMacoustic-van-30942
10/05/2023, 6:09 PMvictorious-lawyer-58417
10/05/2023, 6:11 PMacoustic-van-30942
10/05/2023, 6:31 PMvictorious-lawyer-58417
10/05/2023, 6:37 PMacoustic-van-30942
10/05/2023, 6:38 PMvictorious-lawyer-58417
10/05/2023, 6:40 PMacoustic-van-30942
10/05/2023, 6:48 PMvictorious-lawyer-58417
10/05/2023, 6:51 PMvictorious-lawyer-58417
10/05/2023, 6:52 PMvictorious-lawyer-58417
10/05/2023, 6:54 PMforeach to consume tiny batches in parallel, but it would be effective only if you processed way more data than 5GBacoustic-van-30942
10/05/2023, 6:55 PMforeach as well but then there's overhead in terms of setting up the N batch instances.victorious-lawyer-58417
10/05/2023, 6:55 PM