Can't import Airflow plugins

后端 未结 11 1268
傲寒
傲寒 2021-01-03 18:10

Following Airflow tutorial here.

Problem: The webserver returns the following error

Broken DAG: [/usr/local/airflow/dags/test_operat         


        
11条回答
  •  甜味超标
    2021-01-03 18:54

    In the article it does like this:

    class MyFirstPlugin(AirflowPlugin):
        name = "my_first_plugin"
        operators = [MyFirstOperator]
    

    Instead use:

    class MyFirstPlugin(AirflowPlugin):
        name = "my_first_plugin"
        operators = [MyFirstOperator]
        # A list of class(es) derived from BaseHook
        hooks = []
        # A list of class(es) derived from BaseExecutor
        executors = []
        # A list of references to inject into the macros namespace
        macros = []
        # A list of objects created from a class derived
        # from flask_admin.BaseView
        admin_views = []
        # A list of Blueprint object created from flask.Blueprint
        flask_blueprints = []
        # A list of menu links (flask_admin.base.MenuLink)
        menu_links = []
    

    Also don't use:

    from airflow.operators import MyFirstOperator
    

    According to the airflow article on plugins, it should be:

    from airflow.operators.my_first_plugin import MyFirstOperator
    

    If that doesn't work try:

    from airflow.operators.my_operators import MyFirstOperator
    

    If that doesn't work, check your web server log on startup for more information.

提交回复
热议问题