This is an automated email from the ASF dual-hosted git repository.

pankaj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 566fee79af Fix Scheduler in daemon mode doesn't create PID at the 
specified location (#38117)
566fee79af is described below

commit 566fee79af06f081ed06f3f1329affa307993def
Author: Pankaj Singh <[email protected]>
AuthorDate: Thu Mar 14 12:37:59 2024 +0530

    Fix Scheduler in daemon mode doesn't create PID at the specified location 
(#38117)
    
    * Fix Scheduler in daemon mode doesn't create PID at the specified location
    
    * Update tests
    
    * Update tests
---
 airflow/cli/commands/daemon_utils.py        | 5 ++---
 tests/cli/commands/test_celery_command.py   | 1 +
 tests/cli/commands/test_kerberos_command.py | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/airflow/cli/commands/daemon_utils.py 
b/airflow/cli/commands/daemon_utils.py
index fce0b1d500..d3af46dc05 100644
--- a/airflow/cli/commands/daemon_utils.py
+++ b/airflow/cli/commands/daemon_utils.py
@@ -48,11 +48,10 @@ def run_command_with_daemon_option(
         If not specified, a file path is generated with the default pattern.
     """
     if args.daemon:
+        pid = pid_file or args.pid if pid_file is not None or args.pid is not 
None else None
         pid, stdout, stderr, log_file = setup_locations(
-            process=process_name, stdout=args.stdout, stderr=args.stderr, 
log=args.log_file
+            process=process_name, pid=pid, stdout=args.stdout, 
stderr=args.stderr, log=args.log_file
         )
-        if pid_file:
-            pid = pid_file
 
         # Check if the process is already running; if not but a pidfile 
exists, clean it up
         check_if_pidfile_process_is_running(pid_file=pid, 
process_name=process_name)
diff --git a/tests/cli/commands/test_celery_command.py 
b/tests/cli/commands/test_celery_command.py
index 503c488482..1659588237 100644
--- a/tests/cli/commands/test_celery_command.py
+++ b/tests/cli/commands/test_celery_command.py
@@ -340,6 +340,7 @@ class TestFlowerCommand:
         assert mock_setup_locations.mock_calls == [
             mock.call(
                 process="flower",
+                pid="/tmp/flower.pid",
                 stdout="/tmp/flower-stdout.log",
                 stderr="/tmp/flower-stderr.log",
                 log="/tmp/flower.log",
diff --git a/tests/cli/commands/test_kerberos_command.py 
b/tests/cli/commands/test_kerberos_command.py
index 2c23ac6083..f5c9823f52 100644
--- a/tests/cli/commands/test_kerberos_command.py
+++ b/tests/cli/commands/test_kerberos_command.py
@@ -93,6 +93,7 @@ class TestKerberosCommand:
 
         assert mock_setup_locations.mock_calls[0] == mock.call(
             process="kerberos",
+            pid="/tmp/kerberos.pid",
             stdout="/tmp/kerberos-stdout.log",
             stderr="/tmp/kerberos-stderr.log",
             log="/tmp/kerberos.log",

Reply via email to