Created
December 30, 2021 18:24
-
-
Save cdeil/b46bc16d81a5e2f609e83a4cfc03913a 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 prefect import task, Flow, Parameter | |
@task | |
def print_plus_one(x): | |
print(x + 1) | |
def flow(name): | |
def inner(fn): | |
with Flow(name) as f: | |
fn() | |
return f | |
return inner | |
@flow(name="Parameterized Flow") | |
def f(): | |
x = Parameter('x', default=2) | |
print_plus_one(x=x) | |
# with Flow('Parameterized Flow') as f: | |
# x = Parameter('x', default=2) | |
# print_plus_one(x=x) | |
f.run(parameters=dict(x=1)) # prints 2 | |
f.run(parameters=dict(x=100)) # prints 101 | |
f.run() # prints 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment