Tasks

Sparrow tasks are a tool provided to users that allow backend processes to be run on command from the user interface. These processes could be anything from data importers or periodic processes a lab wants run. Creating a Sparrow task is quick and easy. Look at the following example:

from click import secho
from sparrow.task_manager import task

@task(name="say-hello")
def say_hello():
    secho("Hello World, I am a Sparrow Task", fg='green')

This tiny block of code will create a task viewable on the frontend that when run would print: "Hello World, I am a Sparrow Task" in a nice green color.

Of course this is an rudimentary example; however, you can use Sparrow tasks to do complex things such as run importers or periodic processes (like exporting new data).