airflow.models.renderedtifields
¶
Save Rendered Template Fields
Module Contents¶
Classes¶
Save Rendered Template Fields |
- class airflow.models.renderedtifields.RenderedTaskInstanceFields(ti, render_templates=True)[source]¶
Bases:
airflow.models.base.Base
Save Rendered Template Fields
- classmethod get_templated_fields(ti, session=NEW_SESSION)[source]¶
Get templated field for a TaskInstance from the RenderedTaskInstanceFields table.
- Parameters
ti (airflow.models.taskinstance.TaskInstance) – Task Instance
session (sqlalchemy.orm.Session) – SqlAlchemy Session
- Returns
Rendered Templated TI field
- Return type
Optional[dict]
- classmethod get_k8s_pod_yaml(ti, session=NEW_SESSION)[source]¶
Get rendered Kubernetes Pod Yaml for a TaskInstance from the RenderedTaskInstanceFields table.
- Parameters
ti (airflow.models.taskinstance.TaskInstance) – Task Instance
session (sqlalchemy.orm.Session) – SqlAlchemy Session
- Returns
Kubernetes Pod Yaml
- Return type
Optional[dict]
- write(session=None)[source]¶
Write instance to database
- Parameters
session (sqlalchemy.orm.Session) – SqlAlchemy Session
- classmethod delete_old_records(task_id, dag_id, num_to_keep=conf.getint('core', 'max_num_rendered_ti_fields_per_task', fallback=0), session=None)[source]¶
Keep only Last X (num_to_keep) number of records for a task by deleting others.
In the case of data for a mapped task either all of the rows or none of the rows will be deleted, so we don’t end up with partial data for a set of mapped Task Instances left in the database.
- Parameters
task_id (str) – Task ID
dag_id (str) – Dag ID
num_to_keep – Number of Records to keep
session (sqlalchemy.orm.Session) – SqlAlchemy Session