ashb commented on issue #11982:
URL: https://github.com/apache/airflow/issues/11982#issuecomment-738736003
Tested like this:
```
docker run --rm --entrypoint bash apache/airflow:master-python3.6-ci -c
'airflow db upgrade && exec airflow scheduler'
```
verified that scheduler is pid 1:
```
airflow ❯ docker exec -ti pensive_williamson ps -efw
UID PID PPID C STIME TTY TIME CMD
root 1 0 13 11:34 ? 00:00:04 /usr/local/bin/python
/usr/local/bin/airflow scheduler
root 43 1 0 11:34 ? 00:00:00 airflow scheduler --
DagFileProcessorManager
root 78 0 0 11:34 pts/0 00:00:00 ps -efw
```
Sending pid1 a SIGTERM:
```
airflow ❯ docker exec -ti pensive_williamson kill -TERM 1
```
And then scheduler logs
```
[2020-12-04 11:34:18,234] {scheduler_job.py:1247} INFO - Starting the
scheduler
[2020-12-04 11:34:18,234] {scheduler_job.py:1252} INFO - Processing each
file at most -1 times
[2020-12-04 11:34:18,237] {dag_processing.py:250} INFO - Launched
DagFileProcessorManager with pid: 43
[2020-12-04 11:34:18,238] {scheduler_job.py:1757} INFO - Resetting orphaned
tasks for active dag runs
[2020-12-04 11:34:18,240] {settings.py:52} INFO - Configured default
timezone Timezone('UTC')
[2020-12-04 11:34:18,247] {dag_processing.py:518} WARNING - Because we
cannot use more than 1 thread (parsing_processes = 2 ) when using sqlite. So we
set parallelism to 1.
[2020-12-04 11:35:05,817] {scheduler_job.py:752} INFO - Exiting gracefully
upon receiving signal 15
[2020-12-04 11:35:06,820] {process_utils.py:95} INFO - Sending
Signals.SIGTERM to GPID 43
[2020-12-04 11:35:06,994] {process_utils.py:61} INFO - Process
psutil.Process(pid=43, status='terminated', exitcode=0, started='11:34:18')
(43) terminated with exit code 0
[2020-12-04 11:35:06,995] {process_utils.py:95} INFO - Sending
Signals.SIGTERM to GPID 43
[2020-12-04 11:35:06,995] {scheduler_job.py:1302} INFO - Exited execute loop
```
And it does exit.
----------------------------------------------------------------
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:
[email protected]