maiorBoltach opened a new issue #10868:
URL: https://github.com/apache/airflow/issues/10868


   **Apache Airflow version**: 1.10.12
   
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: Google Cloud, custom-8-16384 
   - **OS** (e.g. from /etc/os-release): CentOS Linux release 7.7.1908 (Core)
   - **Kernel** (e.g. `uname -a`): 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 
17 23:49:17 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
   
   **What happened**:
   
   Class method 
[on_load](https://github.com/apache/airflow/blob/ce66bc944d246aa3b51cce6e2fc13cd25da08d6e/airflow/plugins_manager.py#L102)
 of AirflowPlugin class doesn't run after plugins located in plugin folder, 
only for plugins installed through pip.
   
   **What you expected to happen**:
   
   Method 'on_load' should run on plugins initialization, that are located in 
plugin folder
   
   **How to reproduce it**:
   
   1) Create plugin with next code and place it in plugins folder:
   
   ```
   class TestPlugin(AirflowPlugin):
       menu_links = [MenuLink(category='Google', name='Google', 
url='google.com')]
   
       @classmethod
       def on_load(cls, *args, **kwargs):
           raise AirflowPluginException("Test On Load Exception")
   ```
   2) Reload webserver.
   
   _Result_: Webserver logs are empty, new menu appeared in UI.
   _Expected result_: Webserver logs should contain information with raised 
exception, new menu shouldn't appear in UI.
   _Reason_: on_load method is called only for airflow.plugins.* entry_points
   
https://github.com/apache/airflow/blob/ce66bc944d246aa3b51cce6e2fc13cd25da08d6e/airflow/plugins_manager.py#L152
   
   **Additional information**: It is not clear what is the reason for skipping 
this method call for plugins contained in the folder. At the same time, plugin 
validation successfully run for plugins from a folder and installed via a 
package. Validation uses validate method in same AirflowPlugin class and can be 
extended by user.
   
https://github.com/apache/airflow/blob/b9dc3c51ba2cba1c61d327488cecf2623d6445b3/airflow/plugins_manager.py#L96


----------------------------------------------------------------
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