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
| Attribute | Type | Description |
|---|---|---|
| pb2 | task_definition_pb2.Task | The task protobuf definition. |
| name | str | The name of the task. |
| version | str | The version of the task. |
| entrypoint | bool = False | Whether this task is marked as an entrypoint. Not populated in listing responses; fetch TaskDetails to read the authoritative value from the task template. |
| url | str | Get the console URL for viewing the task. |
Constructor
Signature
def Task(
pb2: task_definition_pb2.Task
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| pb2 | task_definition_pb2.Task | The task protobuf definition. |
Signature
def Task(
pb2: task_definition_pb2.Task
)
Parameters
| Name | Type | Description |
|---|---|---|
| pb2 | task_definition_pb2.Task | The task protobuf definition containing the underlying task data. |
Methods
name()
@classmethod
def name() - > str
The name of the task.
Returns
| Type | Description |
|---|---|
str | The unique identifier name of the task. |
version()
@classmethod
def version() - > str
The version of the task.
Returns
| Type | Description |
|---|---|
str | The 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
| Type | Description |
|---|---|
bool | A 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
| Type | Description |
|---|---|
str | The 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
| Name | Type | Description |
|---|---|---|
| name | str | The name of the task to retrieve. |
| project | `str | None` = None |
| domain | `str | None` = None |
| version | `str | None` = None |
| auto_version | `AutoVersioning | None` = None |
Returns
| Type | Description |
|---|---|
LazyEntity | A 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
| Name | Type | Description |
|---|---|---|
| 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 | The maximum number of tasks to return in the result set. |
| entrypoint | `bool | None` = None |
Returns
| Type | Description |
|---|---|
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. |