about summary refs log tree commit diff
path: root/gn3/commands.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-04-08 14:05:46 -0500
committerFrederick Muriuki Muriithi2025-04-08 14:19:55 -0500
commit1c944a7f890da1a40995eb37624e4b72676b6f76 (patch)
tree1b55d0d76bd38c0d91eda568367a4dbc04d66e91 /gn3/commands.py
parent76c3800320b722edcd24b73ed1a9b860f305ecb8 (diff)
downloadgenenetwork3-1c944a7f890da1a40995eb37624e4b72676b6f76.tar.gz
Add logging to worker.
Diffstat (limited to 'gn3/commands.py')
-rw-r--r--gn3/commands.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/gn3/commands.py b/gn3/commands.py
index 71a4d27..eba01b1 100644
--- a/gn3/commands.py
+++ b/gn3/commands.py
@@ -176,12 +176,20 @@ def run_cmd(cmd: str, success_codes: Tuple = (0,), env: Optional[str] = None) ->
 
 def run_async_cmd(
         conn: Redis, job_queue: str, cmd: Union[str, Sequence[str]],
-        email: Optional[str] = None, env: Optional[dict] = None) -> str:
+        email: Optional[str] = None, log_level: str = "info",
+        env: Optional[dict] = None) -> str:
     """A utility function to call `gn3.commands.queue_cmd` function and run the
     worker in the `one-shot` mode."""
     cmd_id = queue_cmd(conn, job_queue, cmd, email, env)
+    worker_command = [
+        sys.executable,
+        "-m", "sheepdog.worker",
+        "--queue-name", job_queue,
+        "--log-level", log_level
+    ]
+    logging.debug("Launching the worker: %s", worker_command)
     subprocess.Popen( # pylint: disable=[consider-using-with]
-        [sys.executable, "-m", "sheepdog.worker", "--queue-name", job_queue])
+        worker_command)
     return cmd_id