This message was deleted.
# ask-marvin
s
This message was deleted.
m
thought for 131.7 seconds
That example should work in Prefect 3.x. What Prefect does there is: -
cool_task.submit()
returns a
PrefectFuture
- when that future is passed as an argument to another task/flow, Prefect automatically resolves it to its result before execution So this is valid:
Copy code
python
from prefect import task, flow

@task
def cool_task():
    return "sup"

@task
def what_did_cool_task_say(what_it_said: str):
    return f"cool task said {what_it_said}"

@flow
def my_workflow():
    future = cool_task.submit()
    print(what_did_cool_task_say(future))
and should print:
Copy code
cool task said sup
Docs: Handling futures A couple important notes: 1. This is not concurrent for the second task
what_did_cool_task_say(future)
is a normal task call, so the flow waits for it and gets its return value immediately. 2. If you want both tasks orchestrated as submitted task runs, use:
Copy code
python
from prefect import task, flow

@task
def cool_task():
    return "sup"

@task
def what_did_cool_task_say(what_it_said: str):
    return f"cool task said {what_it_said}"

@flow
def my_workflow():
    future = cool_task.submit()
    future_2 = what_did_cool_task_say.submit(future)
    print(future_2.result())
If it “does not work” on your side, can you paste the exact error and your exact Prefect version from:
Copy code
prefect version
Most likely causes are: - an indentation/copy issue from the snippet - running in an environment with an older/different Prefect installed - mixing sync/async patterns somewhere outside this minimal example If you want, I can help debug it from the traceback.