Skip to content

Instantly share code, notes, and snippets.

@anna-geller
Created December 19, 2021 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anna-geller/94bb523205d11a1a909ddf166038fd28 to your computer and use it in GitHub Desktop.
Save anna-geller/94bb523205d11a1a909ddf166038fd28 to your computer and use it in GitHub Desktop.
from datetime import datetime, timedelta
from prefect import task, Flow, Parameter
from prefect.schedules import clocks, Schedule
now = datetime.utcnow()
every_minute = timedelta(minutes=1)
clock1 = clocks.IntervalClock(
start_date=now, interval=every_minute, parameter_defaults=dict(x=9)
)
clock2 = clocks.IntervalClock(
start_date=now, interval=every_minute, parameter_defaults=dict(x=99),
)
schedule = Schedule(clocks=[clock1, clock2])
@task(log_stdout=True)
def plus_one(x):
print(x + 1)
with Flow("parametrized_flow", schedule=schedule) as flow:
param = Parameter("x", default=1)
plus_one(x=param)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment