https://prefect.io logo
Title
j

Jack Sundberg

07/27/2022, 3:52 PM
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

Taylor Curran

07/27/2022, 4:21 PM
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

Jack Sundberg

07/27/2022, 4:26 PM
Awesome! Thank you. Do you think this will be in today's release? (No worries if not)
k

Khuyen Tran

07/27/2022, 4:51 PM
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.
@task 
def add_one(x):
    return x + 1

@flow 
def my_flow():
    future = add_one.submit(1) # return PrefectFuture
t

Taylor Curran

07/27/2022, 5:11 PM
For subflows:
result = subflow()  # int
    state = subflow(return_state=True)  # Prefect State
j

Jack Sundberg

07/27/2022, 5:36 PM
Perfect, thank you for this! Makes my day 100% easier 😄
🎉 1
j

Jai P

07/27/2022, 6:36 PM
curious about this same question, so just confirming:
subflow(return_state=True)
will return a
PrefectFuture
? or a
State
? i could also be misunderstanding the relationship between the two
k

Khuyen Tran

07/27/2022, 7:24 PM
subflow(return_state=True)
will return a
State
👍 1
@Jacinto Graça @Jai P This documentation will make it clearer for you