You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/06 17:06:13 UTC

[GitHub] [airflow] afonit opened a new issue #11309: WorkingDirectory= in systemd

afonit opened a new issue #11309:
URL: https://github.com/apache/airflow/issues/11309


   airflow 1.10.11 Installed from conda-forge (anaconda)
   Ubuntu 
   Linux 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
   
   
   **What works**
   When I start `airflow scheduler` from my desired directory all the jobs work fine.  (I am using papermill and relative paths in the notebooks)
   
   **What isn't working**
   However, when I start the `airflow scheduler` with systemd, the jobs fail and the journalctl shows:
   ```
    [2020-10-06 13:31:16,505] {scheduler_job.py:1383} ERROR - Exception when executing execute_helper
   Oct 06 13:31:16 aa airflow[11629]: Traceback (most recent call last):
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1381, in _execute
   Oct 06 13:31:16 aa airflow[11629]:     self._execute_helper()
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1452, in _execute_helper
   Oct 06 13:31:16 aa airflow[11629]:     if not self._validate_and_run_task_instances(simple_dag_bag=simple_dag_bag):
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1514, in _validate_and_run_task_instances
   Oct 06 13:31:16 aa airflow[11629]:     self.executor.heartbeat()
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/site-packages/airflow/executors/base_executor.py", line 134, in heartbeat
   Oct 06 13:31:16 aa airflow[11629]:     self.sync()
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/site-packages/airflow/executors/sequential_executor.py", line 57, in sync
   Oct 06 13:31:16 aa airflow[11629]:     subprocess.check_call(command, close_fds=True)
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/subprocess.py", line 358, in check_call
   Oct 06 13:31:16 aa airflow[11629]:     retcode = call(*popenargs, **kwargs)
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/subprocess.py", line 339, in call
   Oct 06 13:31:16 aa airflow[11629]:     with Popen(*popenargs, **kwargs) as p:
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/subprocess.py", line 800, in __init__
   Oct 06 13:31:16 aa airflow[11629]:     restore_signals, start_new_session)
   Oct 06 13:31:16 aa airflow[11629]:   File "/home/ubuntu/anaconda3/envs/data_analysis_lab/lib/python3.7/subprocess.py", line 1551, in _execute_child
   Oct 06 13:31:16 aa airflow[11629]:     raise child_exception_type(errno_num, err_msg, err_filename)
   Oct 06 13:31:16 aa airflow[11629]: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'
   ```
   
   I am assuming this is because the `WorkingDirectory` is being ignored from the `[Service]` section in my systemd file.
   
   Is there a way to get `WorkingDirectory` to be used by airflow?
   ```
   [Unit]
   Description=Airflow scheduler daemon
   After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
   Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
   
   [Service]
   EnvironmentFile=/home/ubuntu/notebooks/airflow/airflow
   WorkingDirectory=/home/ubuntu/notebooks
   User=ubuntu
   Group=ubuntu
   Type=simple
   ExecStart=/home/ubuntu/anaconda3/envs/data_analysis_lab/bin/airflow scheduler
   Restart=always
   RestartSec=5s
   
   [Install]
   WantedBy=multi-user.target
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] john-james-sf commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
john-james-sf commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-895593063


   I'll join the bandwagon. I edited the bash file setting the location of the home directory; however, when I run airflow info, I get filenotfound for the default location, not the location set in the script. Please advise/educate.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] afonit commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
afonit commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-891191282


   @zacharya19 ,
   I created mine here:
   ```
   /etc/systemd/system/airflow-scheduler.service
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] afonit closed issue #11309: WorkingDirectory= in systemd

Posted by GitBox <gi...@apache.org>.
afonit closed issue #11309:
URL: https://github.com/apache/airflow/issues/11309


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] afonit commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
afonit commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-707112755


   For others who come across this.
   
   The error was due to, on Ubuntu, The '[Service]` section needs to be `Environment="PATH=/...."` not `EnvironmentFile=...`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ajays1991 commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
ajays1991 commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-888465909


   i am also facing the similar issue. What exactly did you put in `Environment="PATH=/...."` @afonit 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] afonit commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
afonit commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-888473822


   @ajays1991 here is the full systemd file contents:
   ```
   [Unit]
   Description=Airflow scheduler daemon
   After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
   Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
   
   [Service]
   Environment="PATH=/home/ubuntu/miniconda3/envs/data_analysis_lab/bin:$PATH:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin"
   EnvironmentFile=/home/ubuntu/notebooks/airflow/airflow
   WorkingDirectory=/home/ubuntu/notebooks
   User=ubuntu
   Group=ubuntu
   Type=simple
   ExecStart=/home/ubuntu/miniconda3/envs/data_analysis_lab/bin/airflow scheduler
   Restart=always
   RestartSec=5s
   
   [Install]
   WantedBy=multi-user.target
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] afonit closed issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
afonit closed issue #11309:
URL: https://github.com/apache/airflow/issues/11309


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] idnoclip commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
idnoclip commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-1080474228


   I had similar issue on Raspberry Pi - it seemed that somehow service used different PATH variable than the user running it. I managed to work it around by modyfing /etc/systemd/system/airflow-scheduler.service file, replacing the line:
   
   `ExecStart=/bin/bash -c '/path/to/airflow scheduler'`
   
   with
   
   `ExecStart=/bin/bash -c 'PATH=$PATH:/path/to/airflow; /path/to/airflow scheduler'`
   
   This way i was sure that the PATH variable contains path to the airflow executable. 
   Then I had to stop services, reload service daemon and start them again:
   
   `sudo service airflow-webserver stop`
   `sudo service airflow-scheduler stop`
   `sudo systemctl daemon-reload`
   `sudo service airflow-webserver start`
   `sudo service airflow-scheduler start`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] tanujdhiman commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
tanujdhiman commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-892454313


   Hello everybody !!
   
   I'm also facing an error of `FileNotFound Error` when using Airflow.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] tanujdhiman edited a comment on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
tanujdhiman edited a comment on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-892454313


   Hello everybody !!
   
   I'm also facing an error of `FileNotFound Error` when using Airflow.
   
   Can you please tell me how I set my path for a saving a particular file at a specific location??
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Zacharyr41 commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
Zacharyr41 commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-891136281


   > @ajays1991 here is the full systemd file contents:
   > 
   > ```
   > [Unit]
   > Description=Airflow scheduler daemon
   > After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
   > Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
   > 
   > [Service]
   > Environment="PATH=/home/ubuntu/miniconda3/envs/data_analysis_lab/bin:$PATH:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin"
   > EnvironmentFile=/home/ubuntu/notebooks/airflow/airflow
   > WorkingDirectory=/home/ubuntu/notebooks
   > User=ubuntu
   > Group=ubuntu
   > Type=simple
   > ExecStart=/home/ubuntu/miniconda3/envs/data_analysis_lab/bin/airflow scheduler
   > Restart=always
   > RestartSec=5s
   > 
   > [Install]
   > WantedBy=multi-user.target
   > ```
   
   This may be a silly question, but where can I edit this systemd file contents?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] afonit edited a comment on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
afonit edited a comment on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-707112755


   For others who come across this.
   
   The error was due to, on Ubuntu, The `[Service]` section needs to be `Environment="PATH=/...."` not `EnvironmentFile=...`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on issue #11309: FileNotFoundError: [Errno 2] No such file or directory: 'airflow': 'airflow'

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-895850195


   @john-james-sf  - this issue is closed and I think your have a different environment/error. Please open a new discussion (best) rather than issue and describe your circumstances, what you've done, how you installed airflow, which version and all the details you can get. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #11309: WorkingDirectory= in systemd

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #11309:
URL: https://github.com/apache/airflow/issues/11309#issuecomment-704386363


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org