Following Airflow tutorial here.
Problem: The webserver returns the following error
Broken DAG: [/usr/local/airflow/dags/test_operat
I encountered the same error while following these tutorials.
My fault, however, was that I had used space character ' ' in task_id, which isn't supported by Airflow.
Clearly the error didn't point towards the actual problem. Restarting both Airflow scheduler and webserver then showed the correct error message on WebUI.
In my case I managed to make a custom operator with the following steps:
from airflow.operators import MacrosPostgresOperatorcustom_operator.py and the code is pretty simplefrom airflow.plugins_manager import AirflowPlugin
from airflow.operators.postgres_operator import PostgresOperator
class MacrosPostgresOperator(PostgresOperator):
template_fields = ('sql', 'parameters')
class MacrosFirstPlugin(AirflowPlugin):
name = "macros_first_plugin"
operators = [MacrosPostgresOperator]
You must stop (CTRL-C) and restart your Airflow web server and scheduler.
I use airflow 1.10. If it's a custom operator that you want to import, you can upload it to the airflow plugins folder, and then in the DAG specify the import as :
from [filename] import [classname]
where : filename is the name of your plugin file classname is the name of your class.
For example : If the name of your file is my_first_plugin and name of the class is MyFirstOperator then, the import would be :
from my_first_plugin import MyFirstOperator
Worked for me as I am using airflow 1.10
Thanks ! Hope this helps !!
I restarted the webserver, and now everything works fine.
Here is what I think might have happened:
My guess is that the error from step 1 somehow affected step 2.