Skip to main content

Task

This class represents a task definition and provides methods to retrieve, list, and inspect task metadata. It acts as a wrapper around task protobuf definitions, offering properties for task identification and utility methods for generating console URLs. Users can fetch specific task instances by name and version or iterate through filtered lists of tasks within a project and domain.

Attributes

AttributeTypeDescription
pb2task_definition_pb2.TaskThe task protobuf definition.
namestrThe name of the task.
versionstrThe version of the task.
entrypointbool = FalseWhether this task is marked as an entrypoint. Not populated in listing responses; fetch TaskDetails to read the authoritative value from the task template.
urlstrGet the console URL for viewing the task.

Constructor

Signature

def Task(
pb2: task_definition_pb2.Task
) - > null

Parameters

NameTypeDescription
pb2task_definition_pb2.TaskThe task protobuf definition.

Signature

def Task(
pb2: task_definition_pb2.Task
)

Parameters

NameTypeDescription
pb2task_definition_pb2.TaskThe task protobuf definition containing the underlying task data.

Methods


name()

@classmethod
def name() - > str

The name of the task.

Returns

TypeDescription
strThe unique identifier name of the task.

version()

@classmethod
def version() - > str

The version of the task.

Returns

TypeDescription
strThe specific version string associated with this task definition.

entrypoint()

@classmethod
def entrypoint() - > bool

Whether this task is marked as an entrypoint. Not populated in listing responses; fetch TaskDetails to read the authoritative value from the task template.

Returns

TypeDescription
boolA boolean indicating if the task is an entrypoint; defaults to False in listing contexts.

url()

@classmethod
def url() - > str

Get the console URL for viewing the task.

Returns

TypeDescription
strThe full web URL to view this specific task within the management console.

get()

@classmethod
def get(
name: str,
project: str | None = None,
domain: str | None = None,
version: str | None = None,
auto_version: AutoVersioning | None = None
) - > LazyEntity

Get a task by its ID or name. If both are provided, the ID will take precedence.

Parameters

NameTypeDescription
namestrThe name of the task to retrieve.
project`strNone` = None
domain`strNone` = None
version`strNone` = None
auto_version`AutoVersioningNone` = None

Returns

TypeDescription
LazyEntityA lazy-loaded entity representing the requested task details.

listall()

@classmethod
def listall(
by_task_name: str | None = None,
by_task_env: str | None = None,
project: str | None = None,
domain: str | None = None,
sort_by: Tuple[str, Literal["asc", "desc"]]| None = None,
limit: int = 100,
entrypoint: bool | None = None
) - > Union[AsyncIterator[[Task](task.md?sid=flyte_remote__task_task)], Iterator[[Task](task.md?sid=flyte_remote__task_task)]]

Get all tasks for the current project and domain.

Parameters

NameTypeDescription
by_task_name`strNone` = None
by_task_env`strNone` = None
project`strNone` = None
domain`strNone` = None
sort_by`Tuple[str, Literal["asc", "desc"]]None` = None
limitint = 100The maximum number of tasks to return in the result set.
entrypoint`boolNone` = None

Returns

TypeDescription
Union[AsyncIterator[[Task](task.md?sid=flyte_remote__task_task)], Iterator[[Task](task.md?sid=flyte_remote__task_task)]]An iterator or async iterator yielding Task instances matching the filters.