def get_dag(self, store_serialized_dags=False):
        # DBND PATCH
        # unwrap all old logic, as we have recursion call there that makes it not easy to patch

        dag = DagBag(dag_folder=self.fileloc,
                     store_serialized_dags=store_serialized_dags).get_dag(
                         self.dag_id)

        if store_serialized_dags and dag is None:
            dag = DagBag(dag_folder=self.fileloc,
                         store_serialized_dags=False).get_dag(self.dag_id)
        if dag:
            return dag

        from airflow.www_rbac.views import dagbag

        return dagbag.get_dag(dag_id=self.dag_id)
Exemple #2
0
def get_dag_labels(dag_id):
    # reuse airflow webserver dagbag
    if settings.RBAC:
        from airflow.www_rbac.views import dagbag
    else:
        from airflow.www.views import dagbag

    dag = dagbag.get_dag(dag_id)

    if dag is None:
        return [], []

    labels = dag.params.get('labels')

    if labels is None:
        return [], []

    return list(labels.keys()), list(labels.values())
Exemple #3
0
    def get_dag(self, store_serialized_dags=False):
        # DBND PATCH
        # unwrap all old logic, as we have recursion call there that makes it not easy to patch

        if AIRFLOW_ABOVE_6:
            dag = DagBag(
                dag_folder=self.fileloc, store_serialized_dags=store_serialized_dags
            ).get_dag(self.dag_id)

            if store_serialized_dags and dag is None:
                dag = DagBag(
                    dag_folder=self.fileloc, store_serialized_dags=False
                ).get_dag(self.dag_id)
        else:
            dag = DagBag(dag_folder=self.fileloc).get_dag(self.dag_id)

        if dag:
            return dag

        dagbag = get_dagbag_model()

        return dagbag.get_dag(dag_id=self.dag_id)