File tree Expand file tree Collapse file tree
src/dstack/_internal/cli/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,9 +140,15 @@ def _delete(self, args: argparse.Namespace):
140140
141141 def _get (self , args : argparse .Namespace ):
142142 # TODO: Implement non-json output format
143+ fleet_id = None
144+ if args .id :
145+ try :
146+ fleet_id = UUID (args .id )
147+ except ValueError :
148+ raise CLIError (f"Invalid UUID format: { args .id } " )
149+
143150 try :
144151 if args .id :
145- fleet_id = UUID (args .id )
146152 fleet = self .api .client .fleets .get (
147153 project_name = self .api .project , fleet_id = fleet_id
148154 )
@@ -151,7 +157,5 @@ def _get(self, args: argparse.Namespace):
151157 except ResourceNotExistsError :
152158 console .print (f"Fleet [code]{ args .name or args .id } [/] not found" )
153159 exit (1 )
154- except ValueError :
155- raise CLIError (f"Invalid UUID format: { args .id } " )
156160
157161 print (pydantic_orjson_dumps_with_indent (fleet .dict (), default = None ))
Original file line number Diff line number Diff line change @@ -50,16 +50,20 @@ def _command(self, args: argparse.Namespace):
5050
5151 def _get (self , args : argparse .Namespace ):
5252 # TODO: Implement non-json output format
53+ run_id = None
54+ if args .id :
55+ try :
56+ run_id = UUID (args .id )
57+ except ValueError :
58+ raise CLIError (f"Invalid UUID format: { args .id } " )
59+
5360 try :
5461 if args .id :
55- run_id = UUID (args .id )
5662 run = self .api .client .runs .get (project_name = self .api .project , run_id = run_id )
5763 else :
5864 run = self .api .client .runs .get (project_name = self .api .project , run_name = args .name )
5965 except ResourceNotExistsError :
6066 console .print (f"Run [code]{ args .name or args .id } [/] not found" )
6167 exit (1 )
62- except ValueError :
63- raise CLIError (f"Invalid UUID format: { args .id } " )
6468
6569 print (pydantic_orjson_dumps_with_indent (run .dict (), default = None ))
You can’t perform that action at this time.
0 commit comments