You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Tim Swast (JIRA)" <ji...@apache.org> on 2018/07/19 23:31:00 UTC
[jira] [Commented] (AIRFLOW-2243) airflow seems to load modules
multiple times
[ https://issues.apache.org/jira/browse/AIRFLOW-2243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16550015#comment-16550015 ]
Tim Swast commented on AIRFLOW-2243:
------------------------------------
Also `imp.load_source()` is deprecated (and completely undocumented) in Python 3. See: https://bugs.python.org/issue14551
> 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
> Priority: Major
>
> 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)