Auto Scaling
Now with the @function(...)
and @signal(...)
decorators, you have the option to customize how your code will run,
for starters a good auto scaling strategy can be beneficial to make sure your code gets the proper scaling
-
Create a
QueueAutoScaler
instance by importing theQueueAutoScaler
classfrom snowcell.workload import QueueAutoScaler
asg = QueueAutoScaler(max_containers=3, tasks_per_container=2) -
Add the auto scaling instance to your decorator: This will now run your block of code with the asg policy you defined and attached
@client.function(name="my task", cpu=1.5, memory=2, autoscaler=asg)
def predict(**inputs):
return inputs['x'] + inputs['y']
predict(x=3, y=2)