@task(...)

Decorator used to turn a function into a Prism task.

prism.decorators.task(*, retries: int = 0, retry_delay_seconds: int = 0, targets: List[Callable] = [])

  • Parameters

    • *: indicates that the task decorator only accepts keyword arguments.

    • retries: total number of times to retry the task upon failure. Default is 0.

    • retry_delay_seconds: number of seconds to wait in between task retries. Default is 0.

    • targets: list of target decorator calls. Default is an empty list.

Example:

from prism.decorators import task, target
from prism.target import Txt

@task(
    retries=1,
    retry_delay_second=60,
)
def example_task_function(tasks, hooks):
    # do some stuff here
    return ...