happy-wolf-7852
05/07/2024, 1:55 PMfrom metaflow import FlowSpec, conda_base, step, resources, batch, conda
@conda_base(
libraries={
"numpy": "1.24.3"
},
python="3.10.6",
)
class BigSum(FlowSpec):
# @resources(memory=98304, cpu=16)
@step
def start(self):
import numpy
import time
big_matrix = numpy.random.rand(50000, 50000)
t = time.time()
self.sum = numpy.sum(big_matrix)
self.took = time.time() - t
self.next(self.end)
@step
def end(self):
print("The sum is %f." % self.sum)
print("Computing it took %dms." % (self.took * 1000))
if __name__ == '__main__':
BigSum()
Alas whatever I do AWS appears to default to 1cpu and 4GB.
I tried:
python BigSum.py --with batch:cpu=16,memory=98304,queue=our-amazing-queue --environment=conda run
or:
python BigSum.py --with batch --environment=conda run
(uncomment @resources(memory=98304, cpu=16)
Any ideas? is this a metaflow config issue?square-wire-39606
05/07/2024, 4:55 PMhappy-wolf-7852
05/07/2024, 5:34 PMhappy-wolf-7852
05/07/2024, 6:33 PMpython BigSum.py --with batch:cpu=16,memory=98304,queue=bla --environment=conda run
so requesting quite a lot of resource but not for the “real stuff”. It is stuck in status RUNNABLE forever. just gave up and will run things sequentially … it takes 6 hours for 10 folds but was hoping to reduce run time by running model fitting and scoring in parallel using:
…
self.next(self.train_and_score_model, foreach='fold_number_list')
…
@step
def train_and_score_model(self):
…
@step
def join(self, inputs):
print("Rejoining from the folds.")
self.next(self.end)happy-wolf-7852
05/08/2024, 9:33 AMhappy-wolf-7852
05/08/2024, 9:33 AM