3030 BatchLaunchResponseFormatter ,
3131 LaunchResponseFormatter ,
3232 ListCmdDisplay ,
33+ ListStatusDisplay ,
3334 MetricsResponseFormatter ,
3435 StatusResponseFormatter ,
3536)
@@ -313,14 +314,14 @@ def batch_launch(
313314 raise click .ClickException (f"Batch launch failed: { str (e )} " ) from e
314315
315316
316- @cli .command ("status" , help = "Check the status of a running model on the cluster." )
317- @click .argument ("slurm_job_id" , type = str , nargs = 1 )
317+ @cli .command ("status" , help = "Check the status of running vec-inf jobs on the cluster." )
318+ @click .argument ("slurm_job_id" , required = False )
318319@click .option (
319320 "--json-mode" ,
320321 is_flag = True ,
321322 help = "Output in JSON string" ,
322323)
323- def status (slurm_job_id : str , json_mode : bool = False ) -> None :
324+ def status (slurm_job_id : str = None , json_mode : bool = False ) -> None :
324325 """Get the status of a running model on the cluster.
325326
326327 Parameters
@@ -338,14 +339,28 @@ def status(slurm_job_id: str, json_mode: bool = False) -> None:
338339 try :
339340 # Start the client and get model inference server status
340341 client = VecInfClient ()
341- status_response = client .get_status (slurm_job_id )
342+ if not slurm_job_id :
343+ slurm_job_ids = client .fetch_running_jobs ()
344+ if not slurm_job_ids :
345+ click .echo ("No running jobs found." )
346+ return
347+ else :
348+ slurm_job_ids = [slurm_job_id ]
349+ responses = []
350+ for job_id in slurm_job_ids :
351+ responses .append (client .get_status (job_id ))
352+
342353 # Display status information
343- status_formatter = StatusResponseFormatter (status_response )
344- if json_mode :
345- status_formatter .output_json ()
354+ if slurm_job_id :
355+ status_formatter = StatusResponseFormatter (responses [0 ])
356+ if json_mode :
357+ status_formatter .output_json ()
358+ else :
359+ status_info_table = status_formatter .output_table ()
360+ CONSOLE .print (status_info_table )
346361 else :
347- status_info_table = status_formatter . output_table ( )
348- CONSOLE . print ( status_info_table )
362+ list_status_display = ListStatusDisplay ( slurm_job_ids , responses , json_mode )
363+ list_status_display . display_multiple_status_output ( CONSOLE )
349364
350365 except click .ClickException as e :
351366 raise e
0 commit comments