You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/18 17:07:54 UTC

[GitHub] [airflow] mik-laj opened a new pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

mik-laj opened a new pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758
 
 
   ---
   Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
   
   Make sure to mark the boxes below before creating PR: [x]
   
   - [X] Description above provides context of the change
   - [X] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
   - [X] Unit tests coverage for changes (not needed for documentation changes)
   - [X] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [X] Relevant documentation is updated including usage instructions.
   - [X] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   <sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#issuecomment-600940864
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=h1) Report
   > Merging [#7758](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/73305c7bd57f14444804c13b8b290f479832d3db&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `88.17%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7758/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #7758      +/-   ##
   ==========================================
   - Coverage   86.98%   86.93%   -0.06%     
   ==========================================
     Files         915      920       +5     
     Lines       44228    44499     +271     
   ==========================================
   + Hits        38473    38685     +212     
   - Misses       5755     5814      +59     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/serialization/serialized\_objects.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZXJpYWxpemF0aW9uL3NlcmlhbGl6ZWRfb2JqZWN0cy5weQ==) | `90.09% <66.66%> (-0.52%)` | :arrow_down: |
   | [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <80.00%> (-0.37%)` | :arrow_down: |
   | [airflow/plugins\_manager.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wbHVnaW5zX21hbmFnZXIucHk=) | `88.58% <90.78%> (-1.56%)` | :arrow_down: |
   | [airflow/www/app.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvYXBwLnB5) | `94.28% <100.00%> (ø)` | |
   | [...le\_dags/example\_passing\_params\_via\_test\_command.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9wYXNzaW5nX3BhcmFtc192aWFfdGVzdF9jb21tYW5kLnB5) | `100.00% <0.00%> (ø)` | |
   | [...rflow/providers/google/firebase/hooks/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2hvb2tzL2ZpcmVzdG9yZS5weQ==) | `97.29% <0.00%> (ø)` | |
   | [.../google/firebase/example\_dags/example\_firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2V4YW1wbGVfZGFncy9leGFtcGxlX2ZpcmVzdG9yZS5weQ==) | `100.00% <0.00%> (ø)` | |
   | [.../providers/google/cloud/operators/presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy9wcmVzdG9fdG9fZ2NzLnB5) | `38.66% <0.00%> (ø)` | |
   | [...google/cloud/example\_dags/example\_presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL2V4YW1wbGVfZGFncy9leGFtcGxlX3ByZXN0b190b19nY3MucHk=) | `100.00% <0.00%> (ø)` | |
   | [...w/providers/google/firebase/operators/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL29wZXJhdG9ycy9maXJlc3RvcmUucHk=) | `95.65% <0.00%> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=footer). Last update [73305c7...d805f04](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#discussion_r394846445
 
 

 ##########
 File path: airflow/plugins_manager.py
 ##########
 @@ -278,38 +304,90 @@ def initialize_plugins():
 
 def integrate_executor_plugins() -> None:
     """Integrate executor plugins to the context."""
+    # pylint: disable=global-statement
+    global plugins
+    global executors_modules
+    # pylint: enable=global-statement
+
+    if executors_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
     log.debug("Integrate executor plugins")
 
-    for executors_module in executors_modules:
-        sys.modules[executors_module.__name__] = executors_module
+    executors_modules = []
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        executors_module = make_module('airflow.executors.' + plugin_name, plugin.executors)
+        executors_modules.append(executors_module)
+
+        sys.modules[executors_module.__name__] = executors_module  # pylint: disable=no-member
         # noinspection PyProtectedMember
         globals()[executors_module._name] = executors_module  # pylint: disable=protected-access
 
 
 def integrate_dag_plugins() -> None:
     """Integrates operator, sensor, hook, macro plugins."""
+    # pylint: disable=global-statement
+    global plugins
+    global operators_modules
+    global sensors_modules
+    global hooks_modules
+    global macros_modules
+    # pylint: enable=global-statement
+
+    if operators_modules is not None and \
+            sensors_modules is not None and \
+            hooks_modules is not None and \
+            macros_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
-    log.debug("Integrate DAG plugins.")
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
+    log.debug("Integrate DAG plugins")
+
+    operators_modules = []
+    sensors_modules = []
+    hooks_modules = []
+    macros_modules = []
+
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        operators_module = make_module('airflow.operators.' + plugin_name, plugin.operators + plugin.sensors)
 
 Review comment:
   ```suggestion
           operators_module = make_module(f'airflow.operators.{plugin_name}', plugin.operators + plugin.sensors)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj merged pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
mik-laj merged pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#discussion_r394867899
 
 

 ##########
 File path: airflow/plugins_manager.py
 ##########
 @@ -278,38 +304,90 @@ def initialize_plugins():
 
 def integrate_executor_plugins() -> None:
     """Integrate executor plugins to the context."""
+    # pylint: disable=global-statement
+    global plugins
+    global executors_modules
+    # pylint: enable=global-statement
+
+    if executors_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
     log.debug("Integrate executor plugins")
 
-    for executors_module in executors_modules:
-        sys.modules[executors_module.__name__] = executors_module
+    executors_modules = []
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        executors_module = make_module('airflow.executors.' + plugin_name, plugin.executors)
+        executors_modules.append(executors_module)
+
+        sys.modules[executors_module.__name__] = executors_module  # pylint: disable=no-member
         # noinspection PyProtectedMember
         globals()[executors_module._name] = executors_module  # pylint: disable=protected-access
 
 
 def integrate_dag_plugins() -> None:
     """Integrates operator, sensor, hook, macro plugins."""
+    # pylint: disable=global-statement
+    global plugins
+    global operators_modules
+    global sensors_modules
+    global hooks_modules
+    global macros_modules
+    # pylint: enable=global-statement
+
+    if operators_modules is not None and \
+            sensors_modules is not None and \
+            hooks_modules is not None and \
+            macros_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
-    log.debug("Integrate DAG plugins.")
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
+    log.debug("Integrate DAG plugins")
+
+    operators_modules = []
+    sensors_modules = []
+    hooks_modules = []
+    macros_modules = []
+
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        operators_module = make_module('airflow.operators.' + plugin_name, plugin.operators + plugin.sensors)
 
 Review comment:
   We do not have a text formatting convention in the project. Attempts are being made only in this PR:
   https://github.com/apache/airflow/pull/7573

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#issuecomment-600940864
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=h1) Report
   > Merging [#7758](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/73305c7bd57f14444804c13b8b290f479832d3db&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `88.17%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7758/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #7758      +/-   ##
   ==========================================
   - Coverage   86.98%   86.93%   -0.06%     
   ==========================================
     Files         915      920       +5     
     Lines       44228    44499     +271     
   ==========================================
   + Hits        38473    38685     +212     
   - Misses       5755     5814      +59     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/serialization/serialized\_objects.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZXJpYWxpemF0aW9uL3NlcmlhbGl6ZWRfb2JqZWN0cy5weQ==) | `90.09% <66.66%> (-0.52%)` | :arrow_down: |
   | [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <80.00%> (-0.37%)` | :arrow_down: |
   | [airflow/plugins\_manager.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wbHVnaW5zX21hbmFnZXIucHk=) | `88.58% <90.78%> (-1.56%)` | :arrow_down: |
   | [airflow/www/app.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvYXBwLnB5) | `94.28% <100.00%> (ø)` | |
   | [...le\_dags/example\_passing\_params\_via\_test\_command.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9wYXNzaW5nX3BhcmFtc192aWFfdGVzdF9jb21tYW5kLnB5) | `100.00% <0.00%> (ø)` | |
   | [.../google/firebase/example\_dags/example\_firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2V4YW1wbGVfZGFncy9leGFtcGxlX2ZpcmVzdG9yZS5weQ==) | `100.00% <0.00%> (ø)` | |
   | [...rflow/providers/google/firebase/hooks/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2hvb2tzL2ZpcmVzdG9yZS5weQ==) | `97.29% <0.00%> (ø)` | |
   | [...w/providers/google/firebase/operators/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL29wZXJhdG9ycy9maXJlc3RvcmUucHk=) | `95.65% <0.00%> (ø)` | |
   | [.../providers/google/cloud/operators/presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy9wcmVzdG9fdG9fZ2NzLnB5) | `38.66% <0.00%> (ø)` | |
   | [...google/cloud/example\_dags/example\_presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL2V4YW1wbGVfZGFncy9leGFtcGxlX3ByZXN0b190b19nY3MucHk=) | `100.00% <0.00%> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=footer). Last update [73305c7...d805f04](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io commented on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#issuecomment-600940864
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=h1) Report
   > Merging [#7758](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/73305c7bd57f14444804c13b8b290f479832d3db&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `88.17%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7758/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #7758      +/-   ##
   ==========================================
   - Coverage   86.98%   86.93%   -0.06%     
   ==========================================
     Files         915      920       +5     
     Lines       44228    44499     +271     
   ==========================================
   + Hits        38473    38685     +212     
   - Misses       5755     5814      +59     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/serialization/serialized\_objects.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZXJpYWxpemF0aW9uL3NlcmlhbGl6ZWRfb2JqZWN0cy5weQ==) | `90.09% <66.66%> (-0.52%)` | :arrow_down: |
   | [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <80.00%> (-0.37%)` | :arrow_down: |
   | [airflow/plugins\_manager.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wbHVnaW5zX21hbmFnZXIucHk=) | `88.58% <90.78%> (-1.56%)` | :arrow_down: |
   | [airflow/www/app.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvYXBwLnB5) | `94.28% <100.00%> (ø)` | |
   | [...le\_dags/example\_passing\_params\_via\_test\_command.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9wYXNzaW5nX3BhcmFtc192aWFfdGVzdF9jb21tYW5kLnB5) | `100.00% <0.00%> (ø)` | |
   | [...rflow/providers/google/firebase/hooks/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2hvb2tzL2ZpcmVzdG9yZS5weQ==) | `97.29% <0.00%> (ø)` | |
   | [...google/cloud/example\_dags/example\_presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL2V4YW1wbGVfZGFncy9leGFtcGxlX3ByZXN0b190b19nY3MucHk=) | `100.00% <0.00%> (ø)` | |
   | [...w/providers/google/firebase/operators/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL29wZXJhdG9ycy9maXJlc3RvcmUucHk=) | `95.65% <0.00%> (ø)` | |
   | [.../google/firebase/example\_dags/example\_firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2V4YW1wbGVfZGFncy9leGFtcGxlX2ZpcmVzdG9yZS5weQ==) | `100.00% <0.00%> (ø)` | |
   | [.../providers/google/cloud/operators/presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy9wcmVzdG9fdG9fZ2NzLnB5) | `38.66% <0.00%> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=footer). Last update [73305c7...d805f04](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#discussion_r394869624
 
 

 ##########
 File path: airflow/plugins_manager.py
 ##########
 @@ -278,38 +304,90 @@ def initialize_plugins():
 
 def integrate_executor_plugins() -> None:
     """Integrate executor plugins to the context."""
+    # pylint: disable=global-statement
+    global plugins
+    global executors_modules
+    # pylint: enable=global-statement
+
+    if executors_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
     log.debug("Integrate executor plugins")
 
-    for executors_module in executors_modules:
-        sys.modules[executors_module.__name__] = executors_module
+    executors_modules = []
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        executors_module = make_module('airflow.executors.' + plugin_name, plugin.executors)
+        executors_modules.append(executors_module)
+
+        sys.modules[executors_module.__name__] = executors_module  # pylint: disable=no-member
         # noinspection PyProtectedMember
         globals()[executors_module._name] = executors_module  # pylint: disable=protected-access
 
 
 def integrate_dag_plugins() -> None:
     """Integrates operator, sensor, hook, macro plugins."""
+    # pylint: disable=global-statement
+    global plugins
+    global operators_modules
+    global sensors_modules
+    global hooks_modules
+    global macros_modules
+    # pylint: enable=global-statement
+
+    if operators_modules is not None and \
+            sensors_modules is not None and \
+            hooks_modules is not None and \
+            macros_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
-    log.debug("Integrate DAG plugins.")
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
+    log.debug("Integrate DAG plugins")
+
+    operators_modules = []
+    sensors_modules = []
+    hooks_modules = []
+    macros_modules = []
+
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        operators_module = make_module('airflow.operators.' + plugin_name, plugin.operators + plugin.sensors)
 
 Review comment:
   These changes can be made by computers in an automated way, so let's wait for it to happen.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#discussion_r394869624
 
 

 ##########
 File path: airflow/plugins_manager.py
 ##########
 @@ -278,38 +304,90 @@ def initialize_plugins():
 
 def integrate_executor_plugins() -> None:
     """Integrate executor plugins to the context."""
+    # pylint: disable=global-statement
+    global plugins
+    global executors_modules
+    # pylint: enable=global-statement
+
+    if executors_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
     log.debug("Integrate executor plugins")
 
-    for executors_module in executors_modules:
-        sys.modules[executors_module.__name__] = executors_module
+    executors_modules = []
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        executors_module = make_module('airflow.executors.' + plugin_name, plugin.executors)
+        executors_modules.append(executors_module)
+
+        sys.modules[executors_module.__name__] = executors_module  # pylint: disable=no-member
         # noinspection PyProtectedMember
         globals()[executors_module._name] = executors_module  # pylint: disable=protected-access
 
 
 def integrate_dag_plugins() -> None:
     """Integrates operator, sensor, hook, macro plugins."""
+    # pylint: disable=global-statement
+    global plugins
+    global operators_modules
+    global sensors_modules
+    global hooks_modules
+    global macros_modules
+    # pylint: enable=global-statement
+
+    if operators_modules is not None and \
+            sensors_modules is not None and \
+            hooks_modules is not None and \
+            macros_modules is not None:
+        return
+
     ensure_plugins_loaded()
 
-    log.debug("Integrate DAG plugins.")
+    if plugins is None:
+        raise AirflowPluginException("Can't load plugins.")
+
+    log.debug("Integrate DAG plugins")
+
+    operators_modules = []
+    sensors_modules = []
+    hooks_modules = []
+    macros_modules = []
+
+    for plugin in plugins:
+        if plugin.name is None:
+            raise AirflowPluginException("Invalid plugin name")
+        plugin_name: str = plugin.name
+
+        operators_module = make_module('airflow.operators.' + plugin_name, plugin.operators + plugin.sensors)
 
 Review comment:
   These changes can be made by your computer in an automated way, so let's wait for it to happen.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7758: [AIRFLOW-7084] Lazy initialize plugins for each entrypoint
URL: https://github.com/apache/airflow/pull/7758#issuecomment-600940864
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=h1) Report
   > Merging [#7758](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/73305c7bd57f14444804c13b8b290f479832d3db&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `88.17%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/7758/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #7758      +/-   ##
   ==========================================
   - Coverage   86.98%   86.93%   -0.06%     
   ==========================================
     Files         915      920       +5     
     Lines       44228    44499     +271     
   ==========================================
   + Hits        38473    38685     +212     
   - Misses       5755     5814      +59     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/serialization/serialized\_objects.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9zZXJpYWxpemF0aW9uL3NlcmlhbGl6ZWRfb2JqZWN0cy5weQ==) | `90.09% <66.66%> (-0.52%)` | :arrow_down: |
   | [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <80.00%> (-0.37%)` | :arrow_down: |
   | [airflow/plugins\_manager.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wbHVnaW5zX21hbmFnZXIucHk=) | `88.58% <90.78%> (-1.56%)` | :arrow_down: |
   | [airflow/www/app.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvYXBwLnB5) | `94.28% <100.00%> (ø)` | |
   | [...le\_dags/example\_passing\_params\_via\_test\_command.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9wYXNzaW5nX3BhcmFtc192aWFfdGVzdF9jb21tYW5kLnB5) | `100.00% <0.00%> (ø)` | |
   | [...rflow/providers/google/firebase/hooks/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2hvb2tzL2ZpcmVzdG9yZS5weQ==) | `97.29% <0.00%> (ø)` | |
   | [.../providers/google/cloud/operators/presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy9wcmVzdG9fdG9fZ2NzLnB5) | `38.66% <0.00%> (ø)` | |
   | [...w/providers/google/firebase/operators/firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL29wZXJhdG9ycy9maXJlc3RvcmUucHk=) | `95.65% <0.00%> (ø)` | |
   | [.../google/firebase/example\_dags/example\_firestore.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2ZpcmViYXNlL2V4YW1wbGVfZGFncy9leGFtcGxlX2ZpcmVzdG9yZS5weQ==) | `100.00% <0.00%> (ø)` | |
   | [...google/cloud/example\_dags/example\_presto\_to\_gcs.py](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL2V4YW1wbGVfZGFncy9leGFtcGxlX3ByZXN0b190b19nY3MucHk=) | `100.00% <0.00%> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/airflow/pull/7758/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=footer). Last update [73305c7...d805f04](https://codecov.io/gh/apache/airflow/pull/7758?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services