blob: ae24cf6b99e2a3dbbff93fbd334275bf156d8431 [file] [log] [blame]
: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, source_code = 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(session=None)
Writes code into database.
:param session: ORM Session
.. py:method:: bulk_sync_to_db(filelocs, 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(alive_dag_filelocs, 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(fileloc, session=None)
: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(fileloc)
:classmethod:
Returns source code for a given fileloc.
:param fileloc: file path of a DAG
:return: source code as string
.. py:method:: code(fileloc)
:classmethod:
Returns source code for this DagCode object.
:return: source code as string
.. py:method:: dag_fileloc_hash(full_filepath)
:staticmethod:
Hashing file location for indexing.
:param full_filepath: full filepath of DAG file
:return: hashed full_filepath