启动airflow webserver报错:FileNotFoundError: [Errno 2] No such file or directory: 'gunicorn'

启动airflow websever时报错,FileNotFoundError: [Errno 2] No such file or directory: 'gunicorn' ,找不到gunicorn。

  1: $airflow webserver
  2: [2017-06-30 19:06:15,381] {__init__.py:57} INFO - Using executor SequentialExecutor
  3:   ____________       _____________
  4:  ____    |__( )_________  __/__  /________      __
  5: ____  /| |_  /__  ___/_  /_ __  /_  __ \_ | /| / /
  6: ___  ___ |  / _  /   _  __/ _  / / /_/ /_ |/ |/ /
  7:  _/_/  |_/_/  /_/    /_/    /_/  \____/____/|__/
  8:  
  9: /home/admin/python3.6/lib/python3.6/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache instead.
 10:   .format(x=modname), ExtDeprecationWarning
 11: [2017-06-30 19:06:16,351] [24041] {models.py:167} INFO - Filling up the DagBag from /home/admin/airflow/dags
 12: Running the Gunicorn Server with:
 13: Workers: 4 sync
 14: Host: 0.0.0.0:8080
 15: Timeout: 120
 16: Logfiles: - -
 17: =================================================================            
 18: ----------------------------------------------------------------------------------------------------
 19: ['gunicorn', '-w', '4', '-k', 'sync', '-t', '120', '-b', '0.0.0.0:8080', '-n', 'airflow-webserver', '-p', '/home/admin/airflow/airflow-webserver.pid', '-c', 'airflow.www.gunicorn_config', '--access-logfile', '-', '--error-logfile', '-', 'airflow.www.app:cached_app()']
 20: ----------------------------------------------------------------------------------------------------
 21: Traceback (most recent call last):
 22:   File "/bin/airflow", line 28, in <module>
 23:     args.func(args)
 24:   File "/home/admin/python3.6/lib/python3.6/site-packages/airflow/bin/cli.py", line 794, in webserver
 25:     gunicorn_master_proc = subprocess.Popen(run_args)
 26:   File "/home/admin/python3.6/lib/python3.6/subprocess.py", line 707, in __init__
 27:     restore_signals, start_new_session)
 28:   File "/home/admin/python3.6/lib/python3.6/subprocess.py", line 1326, in _execute_child
 29:     raise child_exception_type(errno_num, err_msg)
 30: FileNotFoundError: [Errno 2] No such file or directory: 'gunicorn'
 31: 

airflow webserver启动时,会调用subprocess.Popen创建子进程,webserver使用gunicorn,启动参数:

  1: ['gunicorn', '-w', '4', '-k', 'sync', '-t', '120', '-b', '0.0.0.0:8080', '-n', 'airflow-webserver', '-p', '/home/admin/airflow/airflow-webserver.pid', '-c', 'airflow.www.gunicorn_config', '--access-logfile', '-', '--error-logfile', '-', 'airflow.www.app:cached_app()']

执行gunicorn启动时,因为在PATH中找不到该命令报错。

创建gunicorn软连接

ln –fs /home/admin/python3.6/bin/gunicorn/bin/gunicorn /bin/gunicorn

或者将/home/admin/pytthon3.6/bin添加到PATH,export PATH=${PATH}:/home/admin/python3.6/bin

posted @ 2017-06-30 19:25  lwglinux  阅读(7037)  评论(0编辑  收藏  举报