Tasks#

Task spec#

task_type(ctx: saq.types.Context, *, **kwargs) JSONType:#

Basic task type

Parameters:
Return type:

Any JSON serialisable

Example:

import asyncio

from saq.types import Context

# All functions take in context dict and kwargs
async def double(ctx: Context, *, val: int) -> int:
    await asyncio.sleep(0.5)

    # Result should be json serializable
    return val * 2

Retries#

If you configured retries when enqueueing, your task will automatically retry on any Exception except asyncio.CancelledError

Context#

TODO: Discuss context, and enriching context