Skip to main content

ctx

Returns flyte.models.TaskContext if within a task context, else None Note: Only use this in task code and not module level.

Use :attr:flyte.models.TaskContext.checkpoint for durable task checkpointing (object-store prefixes from the runtime).

def ctx() -> Optional[TaskContext]: ...

Returns flyte.models.TaskContext if within a task context, else None Note: Only use this in task code and not module level.

Use :attr:flyte.models.TaskContext.checkpoint for durable task checkpointing (object-store prefixes from the runtime).

Returns​

TypeDescription
Optional[TaskContext]The task context object if executed within a task, otherwise None.