5252 flush ,
5353 kill ,
5454 logs ,
55- ps ,
55+ # ps,
5656 restart ,
57- terminate ,
57+ # terminate,
5858)
5959from drunc .process_manager .interface .process_manager import run_pm
60- from drunc .unified_shell .commands import boot , start_shell
60+ from drunc .unified_shell .commands import boot , ps , start_shell , terminate
6161from drunc .unified_shell .context import UnifiedShellMode
6262from drunc .unified_shell .shell_utils import generate_fsm_sequence_command
6363from drunc .utils .configuration import ConfTypes , OKSKey
@@ -156,14 +156,14 @@ def unified_shell(
156156 ctx .obj .log .debug ("Setting up the [green]unified_shell[/green] logger" )
157157
158158 # Parse the process manager argument to determine if it's a config or an address
159- unified_shell_log .critical (
159+ ctx . obj . log .critical (
160160 f"Parsing the process manager argument: { process_manager } "
161161 )
162162 process_manager_url : ParseResult = urlparse (process_manager )
163163 internal_pm : bool = True
164164 if process_manager_url .scheme == "grpc" : # i.e. if it's an address
165165 internal_pm = False
166- unified_shell_log .critical (
166+ ctx . obj . log .critical (
167167 f"Process manager argument parsed, internal_pm set to { internal_pm } "
168168 )
169169
@@ -178,7 +178,7 @@ def unified_shell(
178178 # )
179179 # sys.exit(1)
180180
181- unified_shell_log .critical ("TEST" )
181+ ctx . obj . log .critical ("TEST" )
182182 # Setup configuration related context variables
183183 ctx .obj .configuration_file = f"oksconflibs:{ configuration_file } "
184184 ctx .obj .configuration_id = configuration_id
@@ -267,7 +267,7 @@ def unified_shell(
267267 )
268268
269269 else : # Connect to an existing process manager at the provided address
270- unified_shell_log .critical (
270+ ctx . obj . log .critical (
271271 "Connecting to an existing process manager at the provided address"
272272 )
273273 process_manager_address = process_manager .replace (
@@ -286,7 +286,7 @@ def unified_shell(
286286
287287 # Run a simple command (describe) to check the connection with the process manager
288288 desc : Description | None = None
289- unified_shell_log .critical ("Getting driver" )
289+ ctx . obj . log .critical ("Getting driver" )
290290 try :
291291 desc = ctx .obj .get_driver ().describe ()
292292 except Exception as e :
@@ -313,6 +313,7 @@ def unified_shell(
313313 ctx .obj .pm_process .join ()
314314
315315 sys .exit (1 )
316+ ctx .obj .log .critical ("Process manager described successfully" )
316317
317318 # Broadcasting configuration if requested
318319 if desc .HasField ("broadcast" ):
@@ -323,18 +324,20 @@ def unified_shell(
323324
324325 # Add the unified shell Click commands to the CLI
325326 ctx .obj .log .debug ("Adding [green]unified_shell[/green] commands" )
326- ctx .command .add_command (boot , "boot" )
327- ctx .obj .dynamic_commands .add ("boot" )
327+ unified_shell_commands = [boot , ps , terminate ]
328+ for cmd in unified_shell_commands :
329+ ctx .command .add_command (cmd , format_name_for_cli (cmd .name ))
330+ ctx .obj .dynamic_commands .add (format_name_for_cli (cmd .name ))
328331
329332 # Add the process manager Click commands to the CLI
330333 ctx .obj .log .debug ("Adding [green]process_manager[/green] commands" )
331334 process_manager_commands : list [click .Command ] = [
332335 kill ,
333- terminate ,
336+ # terminate,
334337 flush ,
335338 logs ,
336339 restart ,
337- ps ,
340+ # ps,
338341 ]
339342 for cmd in process_manager_commands :
340343 ctx .command .add_command (cmd , format_name_for_cli (cmd .name ))
@@ -475,7 +478,8 @@ def cleanup():
475478
476479 # Terminate any residual processes
477480 if ctx .obj .get_driver ("process_manager" ):
478- ctx .obj .get_driver ("process_manager" ).terminate ()
481+ session_processes = ProcessQuery (session = ctx .obj .session_name )
482+ ctx .obj .get_driver ("process_manager" ).kill (session_processes )
479483
480484 # Check if any processes are still running
481485 if (
0 commit comments