Skip to content

Commit 8cd5f04

Browse files
try this
1 parent 31077e2 commit 8cd5f04

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

pioreactorui/tasks.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import logging
55
import os
6-
import time
76
from logging import handlers
87
from shlex import join
98
from subprocess import check_call
@@ -69,25 +68,17 @@ def initialized():
6968
logger.info("Starting Huey consumer...")
7069
logger.info(f"Cache directory = {CACHE_DIR}")
7170

71+
7272
@huey.task(priority=10)
7373
def pio_run(*args: str, env: dict[str, str] = {}) -> bool:
7474
# for long running pio run jobs where we don't care about the output / status
75-
76-
unique_id = f"pio-stirring-{int(time.time())}" # Ensure a unique unit name
77-
command = (
78-
"systemd-run",
79-
"--unit",
80-
unique_id, # Assigns a unique systemd unit name
81-
"--user", # Runs under the user instance of systemd
82-
"--property=KillSignal=SIGTERM",
83-
"--property=TimeoutStopSec=30",
84-
PIO_EXECUTABLE,
85-
"run",
86-
) + args
75+
command = ("systemd-run", "--user", PIO_EXECUTABLE, "run") + args
8776

8877
env = {k: v for k, v in (env or {}).items() if k in ALLOWED_ENV}
8978
logger.info(f"Executing `{join(command)}`, {env=}")
90-
Popen(command, env=dict(os.environ) | env, stdout=DEVNULL, stderr=DEVNULL)
79+
Popen(
80+
command, start_new_session=True, env=dict(os.environ) | env, stdout=DEVNULL, stderr=STDOUT
81+
)
9182
return True
9283

9384

0 commit comments

Comments
 (0)