Florian Guily

06/09/2022, 1:49 PM
Hey, was wondering if mapped tasks are able to output multiple values with nout ? i have an error when trying with dummy code:
from asyncio.log import logger
import prefect, pymongo, datetime
from prefect import task, Flow, flatten
from prefect.tasks.secrets import PrefectSecret
from prefect.tasks.mysql.mysql import MySQLFetch
from import GitHub

@task(nout= 3)
def produce_output(input):
    return input*2-1, input*2, ["val"+str(input*2-1), "val"+str(input*2)]

def reduce(a):
    return sum(a)

def retry_post(data):
    logger = prefect.context.get("logger")

with Flow("abcdef") as flow:
    success, fail, to_retry =[1, 2, 3, 4])
    total_success = reduce(success)
    total_fail = reduce(fail)

Anna Geller

06/09/2022, 1:52 PM
It's a known issue - you would need to return it as a list rather than a tuple, e.g.
def produce_output(input):
    return [input*2-1, input*2, ["val"+str(input*2-1), "val"+str(input*2)]]

Florian Guily

06/09/2022, 1:52 PM
ok thanks !
👍 1