You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/09/13 11:27:00 UTC

[jira] [Commented] (AIRFLOW-1606) DAG.sync_to_db is static, but takes a DAG as first argument

    [ https://issues.apache.org/jira/browse/AIRFLOW-1606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16164513#comment-16164513 ] 

ASF subversion and git services commented on AIRFLOW-1606:
----------------------------------------------------------

Commit 028b3b88ff4f191c78bf1d9c41bf43a792f640ff in incubator-airflow's branch refs/heads/master from [~ashb]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-airflow.git;h=028b3b8 ]

[AIRFLOW-1606][Airflow-1606][AIRFLOW-1605][AIRFLOW-160] DAG.sync_to_db is now a normal method

Previously it was a static method that took as
it's first argument a
DAG, which really meant it wasn't truly a static
method.

To avoid reversing the parameter order I have
given sensible defaults
from the one and only use in the rest of the code
base.

Also remove documented "sync_to_db" parameter on
DagBag that no longer
exists -- this doc string refers to a parameter
that was removed in
[AIRFLOW-160].

Closes #2605 from ashb/AIRFLOW-1606-db-sync_to_db-
not-static


> 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)