Taragolis commented on code in PR #34945:
URL: https://github.com/apache/airflow/pull/34945#discussion_r1367714633


##########
airflow/cli/commands/daemon_utils.py:
##########
@@ -0,0 +1,89 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import signal
+from argparse import Namespace
+from typing import Callable
+
+from daemon import daemon
+from daemon.pidfile import TimeoutPIDLockFile
+
+from airflow import settings
+from airflow.utils.cli import setup_locations, setup_logging, sigint_handler, 
sigquit_handler
+from airflow.utils.process_utils import check_if_pidfile_process_is_running
+
+
+def run_command_with_daemon_mode(
+    args: Namespace,
+    process_name: str,
+    callback: Callable,
+    should_setup_logging: bool = False,
+    umask: str = settings.DAEMON_UMASK,
+    pid_file: str | None = None,
+):
+    """Run the command in daemon process if enabled or in this process if not.
+
+    Parameters
+    ----------
+    args : Namespace
+        The set of arguments passed to the original CLI command
+    process_name : str
+        Process name used in naming log and PID files for the daemon
+    callback : Callable
+        The actual command to run with or without daemon context
+    should_setup_logging : bool
+        If true, then a log file handler for the daemon process will be created
+    umask : str
+        File access creation mask ("umask") to set for the process on daemon 
start
+    pid_file : str
+        If specified, this file path us used to store daemon process PID.
+        If not specified, a file path is generated with the default pattern.

Review Comment:
   This should be in reStructuredText docstring style



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to