You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Joy Gao (JIRA)" <ji...@apache.org> on 2017/12/08 23:45:00 UTC

[jira] [Updated] (AIRFLOW-1904) Correct DAG fileloc

     [ https://issues.apache.org/jira/browse/AIRFLOW-1904?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joy Gao updated AIRFLOW-1904:
-----------------------------
    Description: 
Currently dag file location `dag.fileloc` is determined by getting the second stack frame from the top, i.e.:

self.fileloc = sys._getframe().f_back.f_code.co_filename

However this fails if the DAG is constructed in an imported module. For example, if I import a DagBuilder in my dagfile, the dagbuilder's filepath would ended up becoming the fileloc, rather than the dag itself. 

This causes a bug whenever the DAG is refreshed, with the message:
```This DAG isn't available in the web server's DagBag object. It shows up in this list because the scheduler marked it as active in the metadata database.```

  was:
Currently dag file location `dag.fileloc` is determined by getting the second stack frame from the top, i.e.:

self.fileloc = sys._getframe().f_back.f_code.co_filename

However this fails if the DAG is constructed in an imported module. For example, if I import a DagBuilder in my dagfile, the dagbuilder's filepath would ended up becoming the fileloc, rather than the dag itself. 

This causes a bug whenever the DAG is attempted to be refreshed, with the message:
```This DAG isn't available in the web server's DagBag object. It shows up in this list because the scheduler marked it as active in the metadata database.```


> Correct DAG fileloc
> -------------------
>
>                 Key: AIRFLOW-1904
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1904
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Joy Gao
>            Assignee: Joy Gao
>
> Currently dag file location `dag.fileloc` is determined by getting the second stack frame from the top, i.e.:
> self.fileloc = sys._getframe().f_back.f_code.co_filename
> However this fails if the DAG is constructed in an imported module. For example, if I import a DagBuilder in my dagfile, the dagbuilder's filepath would ended up becoming the fileloc, rather than the dag itself. 
> This causes a bug whenever the DAG is refreshed, with the message:
> ```This DAG isn't available in the web server's DagBag object. It shows up in this list because the scheduler marked it as active in the metadata database.```



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