flytekit.TaskMetadata

class flytekit.TaskMetadata(cache=False, cache_serialize=False, cache_version='', cache_ignore_input_vars=(), interruptible=None, deprecated='', retries=0, timeout=None, pod_template_name=None)[source]

Metadata for a Task. Things like retries and whether or not caching is turned on, and cache version are specified here.

See the IDL for the protobuf definition.

Parameters:
  • cache (bool) – Indicates if caching should be enabled. See Caching

  • cache_serialize (bool) – Indicates if identical (ie. same inputs) instances of this task should be executed in serial when caching is enabled. See Caching

  • cache_version (str) – Version to be used for the cached value

  • cache_ignore_input_vars (Tuple[str, ...]) – Input variables that should not be included when calculating hash for cache

  • interruptible (Optional[bool]) – Indicates that this task can be interrupted and/or scheduled on nodes with lower QoS guarantees that can include pre-emption. This can reduce the monetary cost executions incur at the cost of performance penalties due to potential interruptions

  • deprecated (str) – Can be used to provide a warning message for deprecated task. Absence or empty str indicates that the task is active and not deprecated

  • retries (int) – for retries=n; n > 0, on failures of this task, the task will be retried at-least n number of times.

  • timeout (Optional[Union[datetime.timedelta, int]]) – the max amount of time for which one execution of this task should be executed for. The execution will be terminated if the runtime exceeds the given timeout (approximately)

  • pod_template_name (Optional[str]) – the name of existing PodTemplate resource in the cluster which will be used in this task.

Methods

to_taskmetadata_model()[source]

Converts to _task_model.TaskMetadata

Return type:

TaskMetadata

Attributes

cache: bool = False
cache_ignore_input_vars: Tuple[str, ...] = ()
cache_serialize: bool = False
cache_version: str = ''
deprecated: str = ''
interruptible: bool | None = None
pod_template_name: str | None = None
retries: int = 0
retry_strategy
timeout: timedelta | int | None = None