What is a task?
This document describes the function of tasks inside the Seaplane platform and how to use them.
Tasks are the building blocks inside Seaplane applications and are defined
through the @task
decorator. Each task should have an id
and a type
. Below
is an example definition of a standard compute
task.
from seaplane import task
@task(type='compute', id='my-task')
def my_task(data)
# run your task code here
The data object inside the function definition holds a JSON object that is retrieved from the previous step in your pipeline (DAG).
Task Types​
There are various different types of tasks available such as compute and inference tasks. You can learn more about the different task types here.
Task resources​
You can add one or multiple resources to a task. Resources are added inside the
@task
decorator. For example, the code snippet below adds a SQL database
resource to the compute task. You can learn more about all available resources
and how to use them here.
from seaplane import task, sql
@task(id='my-task-id', type='compute', sql_db=['username', 'password', 'db-name'])
def my_task(data, sql_db):
sql_db.excute("select * from my_table where ...")
Examples​
Coming soon!