sulphide created AIRFLOW-2243:
---------------------------------

             Summary: airflow seems to load modules multiple times
                 Key: AIRFLOW-2243
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2243
             Project: Apache Airflow
          Issue Type: Bug
            Reporter: sulphide


airflow uses the builtin imp.load_source to load modules, but the documentation 
(for python 2) says:

[https://docs.python.org/2/library/imp.html#imp.load_source]

{{imp.}}{{load_source}}(_name_, _pathname_[, _file_])

Load and initialize a module implemented as a Python source file and return its 
module object. If the module was already initialized, it will be initialized 
_again_. The _name_ argument is used to create or access a module object. 
The_pathname_ argument points to the source file. The _file_ argument is the 
source file, open for reading as text, from the beginning. It must currently be 
a real file object, not a user-defined class emulating a file. Note that if a 
properly matching byte-compiled file (with suffix {{.pyc}} or {{.pyo}}) exists, 
it will be used instead of parsing the given source file.

 

 

this means that airflow behaves differently from a typical python program in 
that a module may be imported multiple times, which could have unexpected 
effects for those relying on the typical python import semantics.

https://github.com/apache/incubator-airflow/blob/master/airflow/models.py#L300



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to