Skip to content

Commit 5bc6845

Browse files
committed
Update session name in opmon configuration
1 parent 7f20a21 commit 5bc6845

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

src/drunc/process_manager/configuration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def __init__(self):
5151

5252

5353
class ProcessManagerConfHandler(ConfHandler):
54-
def __init__(self, log_path: str, *args, **kwargs):
54+
def __init__(self, log_path: str, drunc_session: str, *args, **kwargs):
55+
self.drunc_session = drunc_session
5556
super().__init__(*args, **kwargs)
5657
self.log_path = log_path
5758
self.log = get_logger("process_manager.conf_handler")
@@ -86,7 +87,7 @@ def _parse_dict(self, data):
8687
log=self.log,
8788
conf=data.get("opmon_conf", None),
8889
uri=data.get("opmon_uri", None),
89-
session=new_data.type.name,
90+
session=self.drunc_session,
9091
application="process_manager",
9192
)
9293

src/drunc/process_manager/interface/process_manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def run_pm(
3939
pm_address: str,
4040
log_level: str,
4141
override_logs: bool,
42+
drunc_session: str,
4243
log_path: str = None,
4344
ready_event: bool = None,
4445
signal_handler: bool = None,
@@ -62,7 +63,10 @@ def run_pm(
6263
conf_path, conf_type = parse_conf_url(pm_conf)
6364

6465
pmch = ProcessManagerConfHandler(
65-
log_path=log_path, type=conf_type, data=conf_path.split(":")[1]
66+
log_path=log_path,
67+
type=conf_type,
68+
data=conf_path.split(":")[1],
69+
drunc_session=drunc_session,
6670
)
6771

6872
log_path = get_log_path(
@@ -194,4 +198,5 @@ def process_manager_cli(
194198
log_level=log_level,
195199
override_logs=override_logs,
196200
log_path=log_path,
201+
drunc_session="No-session-pm-cli",
197202
)

src/drunc/process_manager/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ def get_pm_type_from_name(pm_name: str) -> ProcessManagerTypes:
348348

349349
conf_path, conf_type = parse_conf_url(pm_conf_file)
350350
pmch = ProcessManagerConfHandler(
351-
log_path="./", type=conf_type, data=conf_path.split(":")[1]
351+
log_path="./",
352+
type=conf_type,
353+
data=conf_path.split(":")[1],
354+
drunc_session="No-session",
352355
)
353356

354357
return pmch.data.type

src/drunc/unified_shell/shell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def unified_shell(
206206
sys.exit(1)
207207

208208
# Start the process manager as a separate process
209-
ctx.obj.log.info("Starting process manager")
209+
ctx.obj.log.info(
210+
f"Starting process manager with session name {ctx.obj.session_name}"
211+
)
210212
ready_event = mp.Event()
211213
port = mp.Value("i", 0)
212214

@@ -224,6 +226,7 @@ def unified_shell(
224226
"signal_handler": ignore_sigint_sighandler,
225227
# sigint gets sent to the PM, so we need to ignore it, otherwise everytime the user ctrl-c on the shell, the PM goes down
226228
"generated_port": port,
229+
"drunc_session": ctx.obj.session_name,
227230
},
228231
)
229232
ctx.obj.pm_process.start()

0 commit comments

Comments
 (0)