Ash Berlin-Taylor created AIRFLOW-1606:
------------------------------------------

             Summary: DAG.sync_to_db is static, but takes a DAG as first 
argument
                 Key: AIRFLOW-1606
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1606
             Project: Apache Airflow
          Issue Type: Bug
            Reporter: Ash Berlin-Taylor
            Assignee: Ash Berlin-Taylor
            Priority: Minor


As discussed 
https://github.com/apache/incubator-airflow/pull/2602/files#r138567736, 
airflow.models.DAG.sync_to_db is declared as a static method, but it takes as 
it's first argument a DAG object (i.e. the same class that the method is 
delcared on). This is a bit odd.

There are two uses. One in utils/db.py:

{code}
    for dag in dagbag.dags.values():
        models.DAG.sync_to_db(dag, dag.owner, now)
{code}

This would make more sense as {{dag.sync_to_db(synctime=now)}}. The other use 
is inside this method itself:

{code}
        for subdag in dag.subdags:
            DAG.sync_to_db(subdag, owner, sync_time, session=session)
{code}

which could be become {{subdag.sync_to_db(sync_time=sync_time, 
session=session)}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to