Created
December 19, 2021 17:20
-
-
Save anna-geller/94bb523205d11a1a909ddf166038fd28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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