<@ULVA73B9P> is it okay for a task to return a Can...
# ask-marvin
k
@Marvin is it okay for a task to return a Cancelled() state?
m
In Prefect, a task can indeed transition to a
Cancelled
state. This is represented by the
Cancelled
function, which is a convenience function for creating such states. The
Cancelled
state indicates that a task was cancelled before or during its execution. However, it's worth noting that the typical workflow might not involve a task directly returning a
Cancelled
state. Instead, cancellations are usually managed by the flow or the orchestration layer, which can transition tasks to a
Cancelled
state based on certain conditions or external triggers. You can find more details about the
Cancelled
state in the Prefect source code here. If you're implementing task state management, ensure that your logic aligns with your flow's orchestration requirements.