What is an application
This document describes the function of applications in the Seaplane platform and how to use them.
The application, sometimes called pipeline forms the heart of any data science or machine learning pipeline deployed on Seaplane. The app provides the entry point to the application and contains the directed acyclic graph (DAG) that indicates the flow of data.
Apps are created with the @app
decorator. Once configured and deployed the
application sets up all the required infrastructure such as API gateways,
streams between components, compute containers and much more.
Inside the @app
decorator, each application should at least have an ID and an
entry point or trigger. The entry point or trigger to your application can be
powered through HTTP, Kafka streams or a Cron job. You can learn more about
entry points to your application here.
The example below shows an HTTP POST
request-enabled application.
from seaplane import app
@app(id='my-app-id', path='/my-api-endpoint')
def my_application(body):
# your task logic here
The body object between the function brackets contains the data object submitted to the application through the entry point.
The flow of the data is indicated by the DAG defined inside the function
definition below the @app
decorator. It wires together different tasks to get
the desired result.
Tasks are the core building blocks inside Seaplane applications. You can learn more about them here.
The example below shows a simple linear flow through tasks a
, b
and c
.
However, much more intricate flows are possible to create complex applications
easily. You can learn more about them here.
The code below shows how to implement this flow in an application. It assumes
tasks a
, b
and c
are available to the application and defined elsewhere.
from seaplane import app
from ... import a, b, c
@app(id='my-app-id',path='/my-api-endpoint')
def my_application(body):
# defining the DAG
output_a = a(body)
output_b = b(output_a)
output_c = c(output_b)