airflow.models.renderedtifields

Save Rendered Template Fields

Module Contents

Classes

RenderedTaskInstanceFields

Save Rendered Template Fields

class airflow.models.renderedtifields.RenderedTaskInstanceFields(ti: airflow.models.taskinstance.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]

Return repr(self).

classmethod get_templated_fields(cls, ti: airflow.models.taskinstance.TaskInstance, session: sqlalchemy.orm.Session = None) Optional[dict][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: airflow.models.taskinstance.TaskInstance, session: sqlalchemy.orm.Session = None) Optional[dict][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: sqlalchemy.orm.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: sqlalchemy.orm.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?