Sieve Function
Overview
Functions are the fundamental building blocks on Sieve. They have a single entry point and exit point and are defined using standard Python function syntax along with a header that annotates any required dependencies.
All code is mounted by default into /src
of the container.
Calling Functions
Functions already deployed on Sieve can both be referenced by using
run
The .run()
method blocks and waits for the function to complete, and directly returns the value returned by the function.
push
The .push()
method returns a SieveFuture
object, which contains information about the job. You can later access the output using the .result()
method, for example. This is useful for when you are pushing several jobs at once, like when processing frames from a video. This ensures that you are not waiting for previous frames to finish processing before pushing the next ones, and are taking full advantage of parallel processing.
Note: SieveFuture
objects don’t work with traditional concurrent.futures
methods like concurrent.futures.as_completed
or concurrent.futures.wait
.
You can call both .run()
and .push()
locally, or within another Sieve function. Calling .run()
or .push()
within Sieve, allows you to chain function calls together, enabling powerful AI applications!
Custom Functions
To deploy a custom function to Sieve check the SDK guide