Skip to main content

Task

This class represents a task, providing access to its name and version. It allows retrieving tasks by their identifiers and listing all tasks with various filtering and sorting options.

Attributes

  • pb2: task_definition_pb2.Task
    • The protobuf object for the task.

Constructors

  • Initializes a Task object with a protobuf task definition.

  • Parameters

    • pb2: task_definition_pb2.Task
      • The protobuf task definition.

Methods

def name()
  • The name of the task.

  • Return Value: string

    • The name of the task.
def version()
  • The version of the task.

  • Return Value: string

    • The version of the task.
def get(name: string, project: string, domain: string, version: string, auto_version: AutoVersioning) - > LazyEntity
  • Get a task by its ID or name. If both are provided, the ID will take precedence.

Either version or auto_version are required parameters.

:param name: The name of the task. :param project: The project of the task. :param domain: The domain of the task. :param version: The version of the task. :param auto_version: If set to "latest", the latest-by-time ordered from now, version of the task will be used. If set to "current", the version will be derived from the callee tasks context. This is useful if you are deploying all environments with the same version. If auto_version is current, you can only access the task from within a task context.

  • Parameters

    • name: string
      • The name of the task.
    • project: string
      • The project of the task.
    • domain: string
      • The domain of the task.
    • version: string
      • The version of the task.
    • auto_version: AutoVersioning
      • If set to "latest", the latest-by-time ordered from now, version of the task will be used. If set to "current", the version will be derived from the callee tasks context. This is useful if you are deploying all environments with the same version. If auto_version is current, you can only access the task from within a task context.
  • Return Value: LazyEntity

    • LazyEntity
def listall(by_task_name: string, by_task_env: string, project: string, domain: string, sort_by: Tuple[str, Literal["asc", "desc"]], limit: int = 100) - > Union[AsyncIterator[[Task](src_flyte_remote__task_task)], Iterator[[Task](src_flyte_remote__task_task)]]
  • Get all runs for the current project and domain.

:param by_task_name: If provided, only tasks with this name will be returned. :param by_task_env: If provided, only tasks with this environment prefix will be returned. :param project: The project to filter tasks by. If None, the current project will be used. :param domain: The domain to filter tasks by. If None, the current domain will be used. :param sort_by: The sorting criteria for the project list, in the format (field, order). :param limit: The maximum number of tasks to return. :return: An iterator of runs.

  • Parameters

    • by_task_name: string
      • If provided, only tasks with this name will be returned.
    • by_task_env: string
      • If provided, only tasks with this environment prefix will be returned.
    • project: string
      • The project to filter tasks by. If None, the current project will be used.
    • domain: string
      • The domain to filter tasks by. If None, the current domain will be used.
    • sort_by: Tuple[str, Literal["asc", "desc"]]
      • The sorting criteria for the project list, in the format (field, order).
    • limit: int
      • The maximum number of tasks to return.
  • Return Value: Union[AsyncIterator[Task], Iterator[Task]]

    • An iterator of runs.