0Pricing
Flask Academy · Lesson

Define and Call a Task

Write a task and dispatch it with delay.

What a Task Is

A Celery task is just a Python function marked so workers can run it later. You decorate it once and it becomes enqueueable.

The task Decorator

Mark a function with the Celery task decorator. Now it has extra methods like delay that schedule it onto the queue.

@celery.task
def add(x, y):
    return x + y

All lessons in this course

  1. Why Move Work Off the Request
  2. Wire Celery into the App Factory
  3. Define and Call a Task
  4. Track Results and Handle Failures
← Back to Flask Academy