Is there a way to pass indexed items as arguments to a mapped tasks? E.g. If I have some inputs that are a list of tuples that i'm mapping over can I specify specific elements to pass as args when mapping over them? E.g. Something like this:
Copy code
@task
def gen_records():
return [('item', 1), ('item', 2), ('item', 3)]
@task
def subscript_input(x, y):
return x+str(y)
with Flow(
name="Test Flow",
) as test_flow:
records = gen_records()
total = subscript_input.map(x=records[0], y=records[1])
k
Kevin Kho
09/02/2021, 5:52 PM
Hey @Alex Furrier, not really because
records
is of type
List[Tuple]
so
records[0]
would just be the first tuple. You need to pass in the
Tuple
to
subscript_input
or split them out with in intermediate task to list of
item
and a list of the numbers so the you can supply both when mapping.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.