https://prefect.io logo
b

Ben Muller

07/29/2022, 8:13 PM
Hey in the prefect 2.0 docs it says
Copy code
All tasks must be called from within a flow. Tasks may not call other tasks directly.
Does this mean we can't call task.run() like in 1.0? That was quite useful...
Further to this, I'm reading the tutorial getting started docs here https://docs.prefect.io/tutorials/execution/ And on this page a task is called with a
.submit
out of nowhere and with no explanation as to what its doing and why. Maybe worth adding some explanation?
Well there is mention lower down...
Copy code
Call .submit on the task instead of calling the task directly. This submits the task to the task runner rather than running the task in-process.
You may lose some if you don't mention it earlier in the document though.
a

Andrew Huang

07/29/2022, 8:40 PM
There’s also
task.fn()
which calls the underlying function (which I think is equivalent to task.run() if I’m not mistaken)
🚀 1
k

Khuyen Tran

07/29/2022, 9:49 PM
@Ben Muller You’re right. Thanks for the feedback. We will add more description on
.submit
🙏 2
3 Views