Skip to content

Commit 31077e2

Browse files
try this
1 parent 10a51e6 commit 31077e2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pioreactorui/tasks.py

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

44
import logging
55
import os
6+
import time
67
from logging import handlers
78
from shlex import join
89
from subprocess import check_call
@@ -68,20 +69,18 @@ def initialized():
6869
logger.info("Starting Huey consumer...")
6970
logger.info(f"Cache directory = {CACHE_DIR}")
7071

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-
command = ("nohup", PIO_EXECUTABLE, "run") + args
7675

76+
unique_id = f"pio-stirring-{int(time.time())}" # Ensure a unique unit name
7777
command = (
7878
"systemd-run",
79-
"--scope",
80-
"--user", # optional: run as a user unit
81-
"-p",
82-
"KillSignal=SIGTERM",
83-
"-p",
84-
"TimeoutStopSec=30",
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",
8584
PIO_EXECUTABLE,
8685
"run",
8786
) + args

0 commit comments

Comments
 (0)