Preston Marshall

02/07/2020, 3:44 PM
New question: can you run tasks inside of other tasks, or can you only call tasks from the flow itself?


02/07/2020, 4:01 PM
At the end of the day, tasks are just Python functions (by design!) so there’s nothing stopping you from invoking them inside other tasks. However, this foregoes all of the advantages of using a system like Prefect, in which tasks are composed into a flow for orchestration. So while you can do it, we would encourage you to design an alternative, as it will probably only add complexity without major benefit. Note that Prefect will not “automatically” run tasks inside other tasks — you’d have to invoke the mechanisms yourself.