Bhavya M
04/26/2021, 5:53 AMKevin Kho
Bhavya M
04/26/2021, 6:12 AMBhavya M
04/26/2021, 6:15 AMKevin Kho
from prefect import Flow, context, task, unmapped
@task
def say_hello(a, n, x):
print(a, n, x)
@task(nout=2)
def cross_product(x_list, y_list):
test = [(x, y) for x in x_list for y in y_list]
return [x[0] for x in test], [x[1] for x in test]
with Flow("Example Flow!") as flow:
alphabets = ['a', 'b', 'c', 'd']
numbers = [1, 2, 3, 4, 5]
unmapped_constant = 'x'
alphabets, numbers = cross_product(alphabets, numbers)
say_hello.map(alphabets, numbers, unmapped(unmapped_constant))
flow.run()
Bhavya M
04/26/2021, 6:20 AMKevin Kho