| :py:mod:`airflow.models.dagcode` |
| ================================ |
| |
| .. py:module:: airflow.models.dagcode |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.models.dagcode.DagCode |
| |
| |
| |
| |
| Attributes |
| ~~~~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.models.dagcode.log |
| |
| |
| .. py:data:: log |
| |
| |
| |
| |
| .. py:class:: DagCode(full_filepath: str, source_code: Optional[str] = None) |
| |
| Bases: :py:obj:`airflow.models.base.Base` |
| |
| A table for DAGs code. |
| |
| dag_code table contains code of DAG files synchronized by scheduler. |
| |
| For details on dag serialization see SerializedDagModel |
| |
| .. py:attribute:: __tablename__ |
| :annotation: = dag_code |
| |
| |
| |
| .. py:attribute:: fileloc_hash |
| |
| |
| |
| |
| .. py:attribute:: fileloc |
| |
| |
| |
| |
| .. py:attribute:: last_updated |
| |
| |
| |
| |
| .. py:attribute:: source_code |
| |
| |
| |
| |
| .. py:method:: sync_to_db(self, session=None) |
| |
| Writes code into database. |
| |
| :param session: ORM Session |
| |
| |
| .. py:method:: bulk_sync_to_db(cls, filelocs: Iterable[str], session=None) |
| :classmethod: |
| |
| Writes code in bulk into database. |
| |
| :param filelocs: file paths of DAGs to sync |
| :param session: ORM Session |
| |
| |
| .. py:method:: remove_deleted_code(cls, alive_dag_filelocs: List[str], session=None) |
| :classmethod: |
| |
| Deletes code not included in alive_dag_filelocs. |
| |
| :param alive_dag_filelocs: file paths of alive DAGs |
| :param session: ORM Session |
| |
| |
| .. py:method:: has_dag(cls, fileloc: str, session=None) -> bool |
| :classmethod: |
| |
| Checks a file exist in dag_code table. |
| |
| :param fileloc: the file to check |
| :param session: ORM Session |
| |
| |
| .. py:method:: get_code_by_fileloc(cls, fileloc: str) -> str |
| :classmethod: |
| |
| Returns source code for a given fileloc. |
| |
| :param fileloc: file path of a DAG |
| :return: source code as string |
| |
| |
| .. py:method:: code(cls, fileloc) -> str |
| :classmethod: |
| |
| Returns source code for this DagCode object. |
| |
| :return: source code as string |
| |
| |
| .. py:method:: dag_fileloc_hash(full_filepath: str) -> int |
| :staticmethod: |
| |
| Hashing file location for indexing. |
| |
| :param full_filepath: full filepath of DAG file |
| :return: hashed full_filepath |
| |
| |
| |