airflow.models.dagcode
¶
Module Contents¶
-
class
airflow.models.dagcode.
DagCode
(full_filepath, source_code=None)[source]¶ Bases:
airflow.models.Base
A table for DAGs code.
dag_code table contains code of DAG files synchronized by scheduler. This feature is controlled by:
[core] store_serialized_dags = True
: enable this feature[core] store_dag_code = True
: enable this feature
For details on dag serialization see SerializedDagModel
-
classmethod
bulk_sync_to_db
(cls, filelocs, session=None)[source]¶ Writes code in bulk into database.
- Parameters
filelocs – file paths of DAGs to sync
session – ORM Session
-
classmethod
remove_deleted_code
(cls, alive_dag_filelocs, session=None)[source]¶ Deletes code not included in alive_dag_filelocs.
- Parameters
alive_dag_filelocs – file paths of alive DAGs
session – ORM Session
-
classmethod
has_dag
(cls, fileloc, session=None)[source]¶ Checks a file exist in dag_code table.
- Parameters
fileloc – the file to check
session – ORM Session
-
classmethod
get_code_by_fileloc
(cls, fileloc)[source]¶ Returns source code for a given fileloc.
- Parameters
fileloc – file path of a DAG
- Returns
source code as string