Alexandru Anghel
11/09/2022, 5:33 PMfrom tasks.date import get_start_date
@task(name='Generate start date', retries=2, retry_delay_seconds=10)(get_start_date)
It fails with `RuntimeError: Tasks cannot be run outside of a flow. To call the underlying task function outside of a flow use task.fn()
.`
Thanks!Ryan Peden
11/09/2022, 5:39 PMfrom prefect import flow, task
from tasks.date import get_start_date
get_start_date_task = task(get_start_date, name='Generate start date', retries=2, retry_delay_seconds=10)
# you can now call get_start_date_task inside a flow
@flow
def my_flow():
start_date = get_start_date_task()
Alexandru Anghel
11/09/2022, 6:25 PM