<@ULVA73B9P> - is there any way to configure a flo...
# ask-marvin
k
@Marvin - is there any way to configure a flow or a task such that every single task is run in the background? I.E. make it so that I do not have to call
.submit()
on every task?
m
To run tasks in the background automatically without explicitly calling
.submit()
for each task, there are a few approaches you might consider, depending on your Prefect version. For Prefect 3.x, the task runner mechanism can handle how tasks are executed, allowing for running tasks in parallel or distributed environments. You typically use
.submit()
to submit tasks to a task runner like Dask or Ray. This lets tasks run in parallel or distributed environments, but you are interested in bypassing this direct submission step. You might consider assembling tasks that share upstream dependencies in a way that naturally exploits concurrency. Check out the Prefect 3.x task runners documentation to explore using task runners more effectively. For Prefect 2.x, the concept of task runners is similar. You would use
.submit()
to execute tasks concurrently or in parallel. However, automatically embedding this behavior into flow configurations isn't straightforward by default. Nonetheless, crafting your flow to use shared dependencies effectively could implicitly ensure tasks run concurrently. Check out more about Prefect 2.x task runners here. If you're feeling a bit like you've left your towel behind on this one, know that it's a common piece of functionality request and likely to be refined in future prefect evolutions.
tldr, not now and we'd be unlikely to add that exact functionality because its inexplicit
but feel free to plus 1 that issue if you want!
responded! also because of the language you used in your example, ill point you here
which is not quite the same thing as what you're asking for, but may still be helpful
k
Very helpful response and link, thanks as usual @Nate
👍 1