Defining a Sieve Function
To run a function in the cloud, we need to define both:- the Python function to run itself
- its runtime / environment
@sieve.function
decorator on top of your Python function and running sieve deploy
in your directory.
Sieve also supports running functions with a
__setup__
method. This is
especially useful for loading functions into memory once for many jobs.Sieve Function Lifecycle
After you’ve defined your code and environment, you’ll runsieve deploy
to deploy your function to the cloud. On deployment, Sieve will install your Python & system packages, run your build commands, and package your environment and code as a container.
When you run a job, Sieve will spin up a container with your function and run your function with the provided arguments. Our autoscaler will tear down the container after the function has finished running. To control idle time and minimum replicas on your function, see the autoscaling section.
To monitor the state of your workers in the cloud, reference the current_workers
field here.
Jobs are automatically routed to the latest version of your function unless otherwise specified.