data_dag.dag_factory

class data_dag.dag_factory.DagFactory(*, dag_id: str, description: Optional[str] = None, schedule_interval: Optional[Union[timedelta, str]] = None, start_date: Optional[datetime] = None, end_date: Optional[datetime] = None, full_filepath: Optional[str] = None, template_searchpath: Optional[Union[str, Iterable[str]]] = None, user_defined_macros: Optional[Dict] = None, user_defined_filters: Optional[Dict] = None, default_args: Optional[Dict] = None, concurrency: Optional[int] = None, max_active_tasks: Optional[int] = None, max_active_runs: Optional[int] = None, dagrun_timeout: Optional[timedelta] = None, default_view: Optional[str] = None, orientation: Optional[str] = None, catchup: Optional[bool] = None, doc_md: Optional[str] = None, params: Optional[Dict] = None, access_control: Optional[Dict] = None, is_paused_upon_creation: Optional[bool] = None, jinja_environment_kwargs: Optional[Dict] = None, render_template_as_native_obj: bool = False, tags: Optional[List[str]] = None)

Base factory class for generating DAGs.

This class serves as a metadata wrapper around airflow.models.dag.DAG.

The simplest way to create a DAG factory is to inherit from DagFactory and implement _make_dag(), like:

class MyKindOfDag(DagFactory):
    def _make_dag(self):
        start = DummyOperator(...)
        do_something = PythonOperator(...)
        end = DummyOperator(...)

        start >> do_something >> end

The DAG object itself will be automatically created and opened prior to _make_dag() being called. The final DAG can be obtained by calling make_dag() on an instance of your factory:

my_particular_dag_metadata = MyKindOfDag()
dag = my_particular_dag_metadata.make_dag()

For documentation on the attributes of DagFactory, see the DAG type docs.

DAG keyword arguments can be passed in any of three ways (in ascending priority): 1. Overriding default_dag_kwargs() to return a dictionary of default keyword arguments 2. Passing in data during construction (either directly or in an overridden constructor) 3. As a dag_overrides dictionary when calling make_dag()

_make_dag(*args, **kwargs) None

Override this method in a subclass to populate the airflow.models.dag.DAG object with nodes and edges

property default_dag_kwargs: Dict

Override this property in a subclass to provide default arguments to the airflow.models.dag.DAG constructor.

make_dag(*args, dag_overrides: Optional[Dict] = None, **kwargs) airflow.models.dag.DAG

Creates and populates a airflow.models.dag.DAG represented by this metadata

make_dag_object(**overrides) airflow.models.dag.DAG

Creates the basic airflow.models.dag.DAG object represented by this metadata.

This doesn’t populate the DAG with nodes, it is only responsible for creating the initial DAG object.