You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Andreas Koeltringer <an...@n-fuse.co> on 2018/07/06 11:15:33 UTC
Re: Environment variables not working when using systemd
Because systemd does not read environment files from .bashrc. It has its
own way of getting environment files.
Have a look at the systemd unit file doc [1]. Look out for
"Environment=" and "EnvironmentFile=" directives.
Another possibility would be to set the env vars systemwide (e.g. in
/etc/environment) - this however is distribution-dependent.
[1] https://www.freedesktop.org/software/systemd/man/systemd.service.html
On 07/06/2018 12:35 PM, Naik Kaxil wrote:
> Hi guys,
>
> I have recently setup Airflow on a new VM with system integration. I
> have added some environment variables in my bash_rc file for airflow
> user. Now when I try to run a BashOperator by first starting airflow
> using `airflow webserver -D` and `airflow scheduler -D` it seem to have
> access to that environment variables.
>
> But if I use `systemctl start airflow-webserver`, and run the same
> operator, there is no output for the same environment variables.
>
> And I am unable to figure out why is that the case.
>
> Regards,
>
> Kaxil
>
>
>
> Kaxil Naik
>
> Data Reply
> 2nd Floor, Nova South
> 160 Victoria Street, Westminster
> London SW1E 5LB - UK
> phone: +44 (0)20 7730 6000
> k.naik@reply.com <ma...@reply.com>
> www.reply.com
>
> Data Reply
--
Andreas Koeltringer
Mail: andreas.koeltringer@n-fuse.co
Re: Environment variables not working when using systemd
Posted by Naik Kaxil <k....@reply.com>.
Thanks Andreas for the quick answer.
On 06/07/2018, 12:16, "Andreas Koeltringer" <an...@n-fuse.co> wrote:
Because systemd does not read environment files from .bashrc. It has its
own way of getting environment files.
Have a look at the systemd unit file doc [1]. Look out for
"Environment=" and "EnvironmentFile=" directives.
Another possibility would be to set the env vars systemwide (e.g. in
/etc/environment) - this however is distribution-dependent.
[1] https://www.freedesktop.org/software/systemd/man/systemd.service.html
Kaxil Naik
Data Reply
2nd Floor, Nova South
160 Victoria Street, Westminster
London SW1E 5LB - UK
phone: +44 (0)20 7730 6000
k.naik@reply.com
www.reply.com
On 07/06/2018 12:35 PM, Naik Kaxil wrote:
> Hi guys,
>
> I have recently setup Airflow on a new VM with system integration. I
> have added some environment variables in my bash_rc file for airflow
> user. Now when I try to run a BashOperator by first starting airflow
> using `airflow webserver -D` and `airflow scheduler -D` it seem to have
> access to that environment variables.
>
> But if I use `systemctl start airflow-webserver`, and run the same
> operator, there is no output for the same environment variables.
>
> And I am unable to figure out why is that the case.
>
> Regards,
>
> Kaxil
>
>
>
> Kaxil Naik
>
> Data Reply
> 2nd Floor, Nova South
> 160 Victoria Street, Westminster
> London SW1E 5LB - UK
> phone: +44 (0)20 7730 6000
> k.naik@reply.com <ma...@reply.com>
> www.reply.com
>
> Data Reply
--
Andreas Koeltringer
Mail: andreas.koeltringer@n-fuse.co