class flytekit.TaskMetadata(cache=False, cache_serialize=False, cache_version='', interruptible=None, deprecated='', retries=0, timeout=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.

  • 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

  • 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)

Return type




Converts to _task_model.TaskMetadata

Return type



cache: bool = False#
cache_serialize: bool = False#
cache_version: str = ''#
deprecated: str = ''#
interruptible: Optional[bool] = None#
retries: int = 0#
timeout: Optional[Union[datetime.timedelta, int]] = None#