mik-laj commented on a change in pull request #9002:
URL: https://github.com/apache/airflow/pull/9002#discussion_r429854416



##########
File path: airflow/plugins_manager.py
##########
@@ -145,11 +145,12 @@ def load_entrypoint_plugins():
     for entry_point in entry_points:  # pylint: disable=too-many-nested-blocks
         log.debug('Importing entry_point plugin %s', entry_point.name)
         try:
-            plugin_obj = entry_point.load()
-            if is_valid_plugin(plugin_obj):
+            plugin_class = entry_point.load()
+            if is_valid_plugin(plugin_class):
+                plugin_obj = plugin_class()
                 if callable(getattr(plugin_obj, 'on_load', None)):
                     plugin_obj.on_load()
-                    plugins.append(plugin_obj)
+                    plugins.append(plugin_obj())

Review comment:
       We call the class constructor.Previously, we only used the class, not 
the plugin object.
   ```
   >>> class AirflowTestPropertyPlugin(AirflowPlugin):
   ...     name = "test_property_plugin"
   ...     @property
   ...     def operators(self):
   ...         from airflow.models.baseoperator import BaseOperator
   ...         class PluginPropertyOperator(BaseOperator):
   ...             pass
   ...         return [PluginPropertyOperator]
   ...
   >>> print(AirflowTestPropertyPlugin().operators)
   [<class 
'__main__.AirflowTestPropertyPlugin.operators.<locals>.PluginPropertyOperator'>]
   >>> print(AirflowTestPropertyPlugin.operators)
   <property object at 0x10b2172c8>
   
   ```




----------------------------------------------------------------
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:
[email protected]


Reply via email to