https://prefect.io logo
Title
j

Jenia Varavva

05/26/2023, 8:40 PM
Is there a good reason calling sub-flows and/or
run_deployment()
doesn't expose a
PrefectFuture()
interface similar to
Task.submit()
? For a flow like:
@flow
def f():
  a = subflow_foo.submit(1)  # .submit() doesn't exist on Flow or run_deployment().
  b = subflow_foo.submit(2)
  c = subflow_foo.submit(3)

  x = subflow_bar(a, b)
  y = subflow_bar(b, c)

  x.wait()
  y.wait()
I want to get the engine's dependency tracking to kick off downstream sub-flows as soon as their dependencies are satisfied. It feels like I could wrap run_deployment() in a future myself, but maybe I'm missing some non-obvious reason this wouldn't work?
1
n

Nate

05/27/2023, 12:37 AM
hi @Jenia Varavva - this is something on the roadmap https://github.com/PrefectHQ/prefect/issues/6689
🙌 2
j

Jenia Varavva

05/27/2023, 1:33 AM
The closest I was able to get to the functionality is by wrapping
run_deployment()
into a
@task
that I submit to a TaskRunner:
n

Nate

05/27/2023, 4:52 PM
yep - that makes sense! that should work similarly and has been our recommendation for use-cases like this 👍