Skip to main content

TaskDetails

This class provides a detailed representation of a remote task, allowing users to retrieve, inspect, and override task configurations. It supports fetching task metadata by name and version, managing execution interfaces, and defining resource requirements or cache policies. Additionally, it enables remote task execution by forwarding calls to a backend controller within a task context.

Attributes

AttributeTypeDescription
pb2task_definition_pb2.TaskDetailsThe underlying protobuf message containing the task definition and metadata.
max_inline_io_bytesint = 10485760The maximum size in bytes for input/output data to be handled inline rather than via external storage.
overriden_queueOptional[str] = nullThe name of the specific execution queue to use for this task, bypassing the default queue if set.

Constructor

Signature

def TaskDetails(
pb2: task_definition_pb2.TaskDetails,
max_inline_io_bytes: int = 10485760,
overriden_queue: Optional[str] = None
)

Parameters

NameTypeDescription
pb2task_definition_pb2.TaskDetailsThe protobuf representation of the task details.
max_inline_io_bytesint = 10485760The maximum size in bytes for inline input/output data.
overriden_queueOptional[str] = NoneAn optional string to override the default execution queue.

Methods


get()

@classmethod
def get(
name: str,
project: str | None,
domain: str | 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.
project`strNone`
domain`strNone`
version`strNone` = None
auto_version`AutoVersioningNone` = None

Returns

TypeDescription
LazyEntityA lazy entity that will fetch the task details when accessed or awaited.

fetch()

@classmethod
def fetch(
name: str,
project: str | None = None,
domain: str | None = None,
version: str | None = None,
auto_version: AutoVersioning | None = None
) - > [TaskDetails](taskdetails.md?sid=flyte_remote__task_taskdetails)

Fetches the task details from the remote service immediately using the provided identification parameters.

Parameters

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

Returns

TypeDescription
[TaskDetails](taskdetails.md?sid=flyte_remote__task_taskdetails)The fully populated task details object.

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 of the task.

task_type()

@classmethod
def task_type() - > str

The type of the task.

Returns

TypeDescription
strThe string representation of the task type (e.g., python-task, container-task).

default_input_args()

@classmethod
def default_input_args() - > Tuple[str, ...]

The default input arguments of the task.

Returns

TypeDescription
Tuple[str, ...]A tuple containing the names of input arguments that have default values defined.

required_args()

@classmethod
def required_args() - > Tuple[str, ...]

The required input arguments of the task.

Returns

TypeDescription
Tuple[str, ...]A tuple of input argument names that must be provided by the caller.

interface()

@classmethod
def interface() - > [NativeInterface](../../models/nativeinterface.md?sid=flyte_models_nativeinterface)

The interface of the task.

Returns

TypeDescription
[NativeInterface](../../models/nativeinterface.md?sid=flyte_models_nativeinterface)The typed interface defining the inputs and outputs of the task.

cache()

@classmethod
def cache() - > flyte.Cache

The cache policy of the task.

Returns

TypeDescription
flyte.CacheThe caching configuration including behavior, version, and ignored inputs.

secrets()

@classmethod
def secrets() - > List[str]

Get the list of secret keys required by the task.

Returns

TypeDescription
List[str]A list of keys representing the secrets the task needs access to.

resources()

@classmethod
def resources() - > Tuple

Get the resource requests and limits for the task as a tuple (requests, limits).

Returns

TypeDescription
TupleA tuple containing the resource requests and limits defined for the task container.

queue()

@classmethod
def queue() - > Optional[str]

Get the queue name to use for task execution, if overridden.

Returns

TypeDescription
Optional[str]The name of the specific execution queue, or None if the default is used.

override()

@classmethod
def override(
short_name: Optional[str],
resources: Optional[flyte.Resources],
retries: Union[int, flyte.RetryStrategy],
timeout: Optional[flyte.TimeoutType],
env_vars: Optional[Dict[str, str]],
secrets: Optional[flyte.SecretRequest],
max_inline_io_bytes: Optional[int],
cache: Optional[flyte.Cache],
queue: Optional[str]
) - > [TaskDetails](taskdetails.md?sid=flyte_remote__task_taskdetails)

Create a new TaskDetails with overridden properties.

Parameters

NameTypeDescription
short_nameOptional[str]Optional short name for the task.
resourcesOptional[flyte.Resources]Optional resource requirements.
retriesUnion[int, flyte.RetryStrategy]Number of retries or retry strategy.
timeoutOptional[flyte.TimeoutType]Execution timeout.
env_varsOptional[Dict[str, str]]Environment variables to set.
secretsOptional[flyte.SecretRequest]Secret requests for the task.
max_inline_io_bytesOptional[int]Maximum inline I/O size in bytes.
cacheOptional[flyte.Cache]Cache configuration.
queueOptional[str]Queue name for task execution.

Returns

TypeDescription
[TaskDetails](taskdetails.md?sid=flyte_remote__task_taskdetails)A new TaskDetails instance with the overrides applied.