Skip to content

Commit

Permalink
Fix Scheduler in daemon mode doesn't create PID at the specified loca…
Browse files Browse the repository at this point in the history
…tion (apache#38117)

* Fix Scheduler in daemon mode doesn't create PID at the specified location

* Update tests

* Update tests
  • Loading branch information
pankajastro authored Mar 14, 2024
1 parent 0727d0e commit 566fee7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions airflow/cli/commands/daemon_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/cli/commands/test_celery_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ def test_run_command_daemon(self, mock_celery_app, mock_daemon, mock_setup_locat
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",
Expand Down
1 change: 1 addition & 0 deletions tests/cli/commands/test_kerberos_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_run_command_daemon(self, mock_krb, mock_daemon, mock_setup_locations, m

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",
Expand Down

0 comments on commit 566fee7

Please sign in to comment.