airflow.models.renderedtifields

Save Rendered Template Fields

Module Contents

class airflow.models.renderedtifields.RenderedTaskInstanceFields(ti: TaskInstance, render_templates=True)[source]

Bases: airflow.models.base.Base

Save Rendered Template Fields

__tablename__ = rendered_task_instance_fields[source]
dag_id[source]
task_id[source]
execution_date[source]
rendered_fields[source]
k8s_pod_yaml[source]
__repr__(self)[source]
classmethod get_templated_fields(cls, ti: TaskInstance, session: Session = None)[source]

Get templated field for a TaskInstance from the RenderedTaskInstanceFields table.

Parameters
  • ti – Task Instance

  • session – SqlAlchemy Session

Returns

Rendered Templated TI field

classmethod get_k8s_pod_yaml(cls, ti: TaskInstance, session: Session = None)[source]

Get rendered Kubernetes Pod Yaml for a TaskInstance from the RenderedTaskInstanceFields table.

Parameters
  • ti – Task Instance

  • session – SqlAlchemy Session

Returns

Kubernetes Pod Yaml

write(self, session: Session = None)[source]

Write instance to database

Parameters

session – SqlAlchemy Session

classmethod delete_old_records(cls, task_id: str, dag_id: str, num_to_keep=conf.getint('core', 'max_num_rendered_ti_fields_per_task', fallback=0), session: Session = None)[source]

Keep only Last X (num_to_keep) number of records for a task by deleting others

Parameters
  • task_id – Task ID

  • dag_id – Dag ID

  • num_to_keep – Number of Records to keep

  • session – SqlAlchemy Session

Was this entry helpful?