https://prefect.io logo
k

Kevin Systrom

04/29/2020, 12:52 AM
Copy code
import prefect
from prefect.engine import cache_validators
from prefect.engine import signals
from prefect import task, Flow

import pandas as pd

@task(cache_for=pd.Timedelta(minutes=2),
      cache_validator=cache_validators.all_inputs)
def task_b(n):
    print(f'Running task b: {n}')

with Flow('CacheTests') as flow:
    task_b.map([1,2,3])
    
with prefect.context():
    flow.run()