Prism
v0.3.0
v0.3.0
  • 👋Welcome to Prism!
  • Getting Started
    • Installation
    • Creating your first project
    • Why Prism?
  • Fundamentals
    • PrismProject API
      • PrismProject().run
      • PrismProject().graph
    • Tasks
    • Targets
      • Multiple targets
    • CurrentRun API
      • CurrentRun.ref()
      • CurrentRun.conn()
      • CurrentRun.ctx()
  • Connectors
    • Overview
    • BigQueryConnector
    • PostgresConnector
    • RedshiftConnector
    • SnowflakeConnector
    • TrinoConnector
    • PrestoConnector
  • CLI
    • Command Line Interface
    • graph
    • init
    • run
  • Advanced features
    • Concurrency
    • Logging
    • Callbacks
    • Retries
    • Skipping tasks
  • API Reference
    • prism.task.PrismTask
    • @task(...)
    • @target(...)
    • @target_iterator(...)
    • prism.target.PrismTarget
  • Use Cases
    • Analytics on top of dbt
    • Machine Learning
  • Wiki
    • DAGs
Powered by GitBook
On this page
  1. Advanced features

Retries

Retries allow you to re-run a task upon failure. They're pretty easy to configure:

For class-based tasks, you can adjust the number of times a task should be retried by setting the RETRIES and RETRY_DELAY_SECONDS class attributes:

  • RETRIES: the number of times the task should be retried. Default is 0.

  • RETRY_DELAY_SECONDS: the number of seconds to wait in between retries. Must be specified alongside RETRIES. Default is 0.

For example:

# tasks/example_task.py

import prism.task

class ExampleTask(prism.task.PrismTask):
    
    RETRIES = 1
    RETRY_DELAY_SECONDS = 60
        
    def run(self, tasks, hooks):
        test_str = "Hello, world!"
        return test_str

For function-based tasks, you can adjust the number of times a task should be retried by setting the retries and retry_delay_seconds keyword arguments to the @task decorator:

  • retries: the number of times the task should be retried. Default is 0.

  • retry_delay_seconds: the number of seconds to wait in between retries. Must be specified alongside retries. Default is 0.

For example:

# tasks/example_task.py

from prism.decorators import task

@task(
    retries=1,
    retry_delay_seconds=60
)
def example_task(tasks, hooks):
    test_str = "Hello, world!"
    return test_str

PreviousCallbacksNextSkipping tasks

Last updated 1 year ago