Airflow reset environment variable while running bashoperator

Deadly 提交于 2020-03-04 23:07:26

问题


With one of my airflow task, I have an environment variable issue.

[2019-08-19 04:51:04,603] {{bash_operator.py:127}} INFO -   File "/home/ubuntu/.pyenv/versions/3.6.7/lib/python3.6/os.py", line 669, in __getitem__
[2019-08-19 04:51:04,603] {{bash_operator.py:127}} INFO -     raise KeyError(key) from None
[2019-08-19 04:51:04,603] {{bash_operator.py:127}} INFO - KeyError: 'HOME'
[2019-08-19 04:51:04,639] {{bash_operator.py:131}} INFO - Command exited with return code 1

And my task is the following:

task_name = BashOperator(
    task_id='task_name',
    bash_command="cd path/to/manage.py && export LC_ALL=C.UTF-8 && export LANG=C.UTF-8 "
    f'&& {Variable.get("python_virtualenv_path")}virtual-env-name/bin/python manage.py command_name',
    retries=1,
    pool='LightAndFast',
    dag=dag
)

Any ideas of this issue?

来源:https://stackoverflow.com/questions/57550692/airflow-reset-environment-variable-while-running-bashoperator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!