Thread
#prefect-community
    Vamsi Reddy

    Vamsi Reddy

    7 months ago
    Hi everyone, so i have a task that return a list of module_names. However this list is not fixed and can vary in length. I am iterating over this list to get the names and then run those modules in a seperate task. Is it possible to specify the output as a list. I tried using nout =1 but it just outputs 1 element of the list.I get the following error :
    TypeError: Task is not iterable. If your task returns multiple results, pass `nout` to the task decorator/constructor, or provide a `Tuple` return-type annotation to your task.
    Kevin Kho

    Kevin Kho

    7 months ago
    You should be able to. I have something similar in my demo here.
    I think you are trying to access a list or dict in the flow block?
    Vamsi Reddy

    Vamsi Reddy

    7 months ago
    so the no of elements in my list is not fixed. but i am sure i will be returning 1 list. then i do
    for module_name in list:
       process = process_module(module_name)
       tasks.append(process)
    here the list length is not fixed since we get the module names from an external file
    Kevin Kho

    Kevin Kho

    7 months ago
    Yes it should still work if you pass 1 list as output