https://prefect.io logo
#prefect-community
Title
# prefect-community
f

Frank Embleton

05/15/2022, 11:38 AM
Hello am new to prefect and just reading through the docs. On the Flows page this is super confusing to me:
Return a future
If a flow returns one or more futures, the final state is determined based on the underlying states.
```from prefect import task, flow
@task
def always_fails_task():
raise ValueError("I am bad task")
@task
def always_succeeds_task():
return "foo"
@flow
def always_succeeds_flow():
x = always_fails_task()
y = always_succeeds_task()
return y```
What does it mean by futures here? My understanding was that futures are to do with threading and async in Python, of which I see neither here? What am I missing? 🤔
a

Anna Geller

05/15/2022, 12:00 PM
this doc means PrefectFutures which represent the result of a computation happening in a task runner.
Copy code
>>> @flow
>>> def my_flow():
>>>     future = my_task()  # PrefectFuture[str, Sync] includes result type
>>>     future.run_id  # UUID for the task run
f

Frank Embleton

05/15/2022, 12:07 PM
Thanks @Anna Geller 🙏 I have submitted a PR to the docs to link
👍 1
🙏 1
5 Views