问题
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