Search code examples
airflowairflow-scheduler

airflow trigger_dag command throwing error


I am executing airflow trigger_dag cng-hello_world command in airflow server and it resulted in below error. please suggest.

I followed below link:- http://michal.karzynski.pl/blog/2017/03/19/developing-workflows-with-apache-airflow/

The same Dag is been executed via airflow UI

[2019-02-06 11:57:41,755] {settings.py:174} INFO - setting.configure_orm(): Using pool settings. pool_size=5, pool_recycle=2000
[2019-02-06 11:57:43,326] {plugins_manager.py:97} ERROR - invalid syntax (airflow_api.py, line 7)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/airflow/plugins_manager.py", line 86, in <module>
    m = imp.load_source(namespace, filepath)
  File "/home/ec2-user/airflow/plugins/airflow_api.py", line 7
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax
[2019-02-06 11:57:43,326] {plugins_manager.py:98} ERROR - Failed to import plugin /home/ec2-user/airflow/plugins/airflow_api.py
[2019-02-06 11:57:43,326] {plugins_manager.py:97} ERROR - invalid syntax (__init__.py, line 7)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/airflow/plugins_manager.py", line 86, in <module>
    m = imp.load_source(namespace, filepath)
  File "/home/ec2-user/airflow/plugins/__init__.py", line 7
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax
[2019-02-06 11:57:43,327] {plugins_manager.py:98} ERROR - Failed to import plugin /home/ec2-user/airflow/plugins/__init__.py
[2019-02-06 11:57:47,236] {__init__.py:51} INFO - Using executor CeleryExecutor
[2019-02-06 11:57:48,420] {models.py:258} INFO - Filling up the DagBag from /home/ec2-user/airflow/dags
[2019-02-06 11:57:48,783] {cli.py:237} INFO - Created <DagRun cng-hello_world @ 2019-02-06 11:57:48+00:00: manual__2019-02-06T11:57:48+00:00, externally triggered: True>

Solution

  • I had the same problem with trigger_dag. I finally solved my problem with other docs like AWS MWAA Invoke Dag. Just change the command to:

    body = 'dags trigger your-target-dag-id'