For Orion, is there a way to have subflows return ...
# prefect-community
j
For Orion, is there a way to have subflows return futures as they did in earlier beta versions? So something like a my_flow.submit() method for parallelism...?
👀 1
t
Hi Jack, I can confirm there will be a way to return subflow states and allow for similar functionality to
.submit()
. We are currently writing the documentation for this and appreciate your patience during this busy time. 😊
j
Awesome! Thank you. Do you think this will be in today's release? (No worries if not)
k
Hi Jack, yes it will be in Prefect 2.0b16. I’ll paste a link here when it is available
In summary, this is how to return futures: To get a
PrefectFuture
, add
.submit()
to your task call.
Copy code
@task 
def add_one(x):
    return x + 1

@flow 
def my_flow():
    future = add_one.submit(1) # return PrefectFuture
t
For subflows:
Copy code
result = subflow()  # int
    state = subflow(return_state=True)  # Prefect State
j
Perfect, thank you for this! Makes my day 100% easier 😄
🎉 1
j
curious about this same question, so just confirming:
Copy code
subflow(return_state=True)
will return a
PrefectFuture
? or a
State
? i could also be misunderstanding the relationship between the two
k
Copy code
subflow(return_state=True)
will return a
State
👍 1
@Jacinto Graça @Jai P This documentation will make it clearer for you