thestage 0.6.4__py3-none-any.whl → 0.6.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. thestage/__init__.py +1 -1
  2. thestage/color_scheme/color_scheme.py +1 -0
  3. thestage/controllers/base_controller.py +4 -3
  4. thestage/controllers/config_controller.py +16 -4
  5. thestage/controllers/container_controller.py +147 -49
  6. thestage/controllers/instance_controller.py +35 -9
  7. thestage/controllers/project_controller.py +334 -86
  8. thestage/entities/container.py +5 -3
  9. thestage/entities/project_inference_simulator.py +2 -1
  10. thestage/entities/project_inference_simulator_model.py +1 -1
  11. thestage/entities/project_task.py +2 -3
  12. thestage/entities/rented_instance.py +2 -2
  13. thestage/entities/self_hosted_instance.py +2 -2
  14. thestage/helpers/error_handler.py +3 -3
  15. thestage/services/clients/git/git_client.py +8 -12
  16. thestage/services/clients/thestage_api/api_client.py +144 -109
  17. thestage/services/clients/thestage_api/dtos/base_controller/connect_resolve_response.py +21 -0
  18. thestage/services/clients/thestage_api/dtos/container_param_request.py +1 -1
  19. thestage/services/clients/thestage_api/dtos/container_response.py +1 -21
  20. thestage/services/clients/thestage_api/dtos/docker_container_controller/docker_container_list_request.py +2 -1
  21. thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_request.py +7 -1
  22. thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_response.py +0 -1
  23. thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_sagemaker_request.py +1 -0
  24. thestage/services/clients/thestage_api/dtos/inference_controller/get_inference_simulator_request.py +2 -1
  25. thestage/services/clients/thestage_api/dtos/inference_controller/{inference_simulator_list_for_project_request.py → inference_simulator_list_request.py} +3 -2
  26. thestage/services/clients/thestage_api/dtos/inference_controller/{inference_simulator_list_for_project_response.py → inference_simulator_list_response.py} +1 -1
  27. thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_model_list_for_project_request.py +2 -1
  28. thestage/services/clients/thestage_api/dtos/instance_rented_response.py +4 -37
  29. thestage/services/clients/thestage_api/dtos/logging_controller/log_polling_request.py +3 -3
  30. thestage/services/clients/thestage_api/dtos/logging_controller/user_logs_query_request.py +3 -11
  31. thestage/services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_request.py +1 -0
  32. thestage/services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_request.py +2 -1
  33. thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_request.py +2 -4
  34. thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_request.py +5 -3
  35. thestage/services/clients/thestage_api/dtos/project_response.py +3 -15
  36. thestage/services/clients/thestage_api/dtos/selfhosted_instance_response.py +2 -20
  37. thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_key_to_user_response.py +1 -1
  38. thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_public_key_to_instance_request.py +4 -2
  39. thestage/services/clients/thestage_api/dtos/ssh_key_controller/is_user_has_public_ssh_key_response.py +1 -1
  40. thestage/services/clients/thestage_api/dtos/task_controller/task_list_for_project_request.py +4 -1
  41. thestage/services/clients/thestage_api/dtos/task_controller/task_view_response.py +0 -2
  42. thestage/services/config_provider/config_provider.py +2 -2
  43. thestage/services/connect/connect_service.py +76 -73
  44. thestage/services/container/container_service.py +23 -19
  45. thestage/services/container/mapper/container_mapper.py +2 -1
  46. thestage/services/instance/instance_service.py +13 -20
  47. thestage/services/instance/mapper/instance_mapper.py +1 -3
  48. thestage/services/instance/mapper/selfhosted_mapper.py +3 -4
  49. thestage/services/logging/logging_service.py +40 -40
  50. thestage/services/project/dto/inference_simulator_dto.py +1 -10
  51. thestage/services/project/dto/inference_simulator_model_dto.py +2 -10
  52. thestage/services/project/dto/project_config.py +3 -2
  53. thestage/services/project/mapper/project_inference_simulator_mapper.py +1 -0
  54. thestage/services/project/mapper/project_inference_simulator_model_mapper.py +3 -3
  55. thestage/services/project/mapper/project_task_mapper.py +2 -3
  56. thestage/services/project/project_service.py +161 -131
  57. thestage/services/remote_server_service.py +1 -0
  58. thestage/services/task/dto/task_dto.py +3 -23
  59. {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info}/METADATA +3 -2
  60. {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info}/RECORD +63 -72
  61. {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info}/WHEEL +1 -1
  62. thestage/services/clients/thestage_api/dtos/cloud_provider_region.py +0 -19
  63. thestage/services/clients/thestage_api/dtos/docker_container_assigned_device.py +0 -10
  64. thestage/services/clients/thestage_api/dtos/enums/currency_type.py +0 -10
  65. thestage/services/clients/thestage_api/dtos/enums/daemon_status.py +0 -9
  66. thestage/services/clients/thestage_api/dtos/enums/disk_type.py +0 -7
  67. thestage/services/clients/thestage_api/dtos/enums/drive_type.py +0 -7
  68. thestage/services/clients/thestage_api/dtos/enums/instance_type.py +0 -7
  69. thestage/services/clients/thestage_api/dtos/enums/location_region.py +0 -11
  70. thestage/services/clients/thestage_api/dtos/enums/power_status.py +0 -10
  71. thestage/services/clients/thestage_api/dtos/price_definition.py +0 -14
  72. {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info}/entry_points.txt +0 -0
  73. {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info/licenses}/LICENSE.txt +0 -0
@@ -32,8 +32,19 @@ app.add_typer(config_app, name="config", rich_help_panel=get_command_group_help_
32
32
 
33
33
  @app.command(name='clone', no_args_is_help=True, help=__("Clone project repository to empty directory"), **get_command_metadata(CliCommand.PROJECT_CLONE))
34
34
  def clone(
35
- project_uid: str = typer.Argument(
36
- help=__("Project unique ID"),
35
+ project_public_id: Optional[str] = typer.Option(
36
+ None,
37
+ "--project-id",
38
+ "-pid",
39
+ help=__("Project ID. ID or name is required"),
40
+ is_eager=False,
41
+ ),
42
+ project_slug: Optional[str] = typer.Option(
43
+ None,
44
+ "--project-name",
45
+ "-pn",
46
+ help=__("Project name. ID or name is required."),
47
+ is_eager=False,
37
48
  ),
38
49
  working_directory: Optional[str] = typer.Option(
39
50
  None,
@@ -47,14 +58,19 @@ def clone(
47
58
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
48
59
  check_command_permission(command_name)
49
60
 
61
+ if sum(v is not None for v in [project_public_id, project_slug]) != 1:
62
+ typer.echo("Please provide a single identifier for the project - name or ID.")
63
+ raise typer.Exit(1)
64
+
50
65
  if not working_directory:
51
- working_directory = get_current_directory().joinpath(project_uid)
66
+ working_directory = get_current_directory().joinpath(project_slug)
52
67
 
53
68
  service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
54
69
  project_service = service_factory.get_project_service()
55
70
 
56
71
  project_service.clone_project(
57
- project_slug=project_uid,
72
+ project_slug=project_slug,
73
+ project_public_id=project_public_id,
58
74
  )
59
75
 
60
76
  raise typer.Exit(0)
@@ -62,8 +78,19 @@ def clone(
62
78
 
63
79
  @app.command(name='init', no_args_is_help=True, help=__("Initialize project repository with existing files"), **get_command_metadata(CliCommand.PROJECT_INIT))
64
80
  def init(
65
- project_uid: Optional[str] = typer.Argument(
66
- help=__("Project unique ID"),
81
+ project_public_id: Optional[str] = typer.Option(
82
+ None,
83
+ "--project-id",
84
+ "-pid",
85
+ help=__("Project ID. ID or name is required"),
86
+ is_eager=False,
87
+ ),
88
+ project_slug: Optional[str] = typer.Option(
89
+ None,
90
+ "--project-name",
91
+ "-pn",
92
+ help=__("Project name. ID or name is required."),
93
+ is_eager=False,
67
94
  ),
68
95
  working_directory: Optional[str] = typer.Option(
69
96
  None,
@@ -77,6 +104,10 @@ def init(
77
104
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
78
105
  check_command_permission(command_name)
79
106
 
107
+ if sum(v is not None for v in [project_public_id, project_slug]) != 1:
108
+ typer.echo("Please provide a single identifier for the project - name or ID.")
109
+ raise typer.Exit(1)
110
+
80
111
  service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
81
112
  project_service = service_factory.get_project_service()
82
113
  project_config = service_factory.get_config_provider().read_project_config()
@@ -86,7 +117,8 @@ def init(
86
117
  raise typer.Exit(1)
87
118
 
88
119
  project_service.init_project(
89
- project_slug=project_uid,
120
+ project_slug=project_slug,
121
+ project_public_id=project_public_id,
90
122
  )
91
123
 
92
124
  raise typer.Exit(0)
@@ -104,11 +136,18 @@ def run(
104
136
  help=__("Commit hash to use. By default, the current HEAD commit is used."),
105
137
  is_eager=False,
106
138
  ),
107
- docker_container_slug: Optional[str] = typer.Option(
139
+ docker_container_public_id: Optional[str] = typer.Option(
108
140
  None,
109
- '--container-uid',
141
+ '--container-id',
110
142
  '-cid',
111
- help=__("Docker container unique ID"),
143
+ help=__("Docker container ID"),
144
+ is_eager=False,
145
+ ),
146
+ docker_container_slug: Optional[str] = typer.Option(
147
+ None,
148
+ '--container-name',
149
+ '-cn',
150
+ help=__("Docker container name"),
112
151
  is_eager=False,
113
152
  ),
114
153
  working_directory: Optional[str] = typer.Option(
@@ -152,6 +191,10 @@ def run(
152
191
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
153
192
  check_command_permission(command_name)
154
193
 
194
+ if sum(v is not None for v in [docker_container_public_id, docker_container_slug]) != 1:
195
+ typer.echo("Please provide a single identifier for the container - name or ID.")
196
+ raise typer.Exit(1)
197
+
155
198
  if not command:
156
199
  typer.echo(__('Command is required'))
157
200
  raise typer.Exit(1)
@@ -162,6 +205,7 @@ def run(
162
205
  task: Optional[TaskDto] = project_service.project_run_task(
163
206
  run_command=" ".join(command),
164
207
  commit_hash=commit_hash,
208
+ docker_container_public_id=docker_container_public_id,
165
209
  docker_container_slug=docker_container_slug,
166
210
  task_title=task_title,
167
211
  files_to_add=files_to_add,
@@ -170,14 +214,14 @@ def run(
170
214
 
171
215
  if enable_log_stream:
172
216
  logging_service: LoggingService = service_factory.get_logging_service()
173
- logging_service.stream_task_logs_with_controls(task_id=task.id)
217
+ logging_service.stream_task_logs_with_controls(task_public_id=task.public_id)
174
218
 
175
219
  raise typer.Exit(0)
176
220
 
177
221
 
178
222
  @task_app.command(name='cancel', no_args_is_help=True, help=__("Cancel a task by ID"), **get_command_metadata(CliCommand.PROJECT_TASK_CANCEL))
179
223
  def cancel_task(
180
- task_id: Annotated[int, typer.Argument(
224
+ task_id: Annotated[str, typer.Argument(
181
225
  help=__("Task ID (required)"),
182
226
  )],
183
227
  ):
@@ -186,14 +230,14 @@ def cancel_task(
186
230
  check_command_permission(command_name)
187
231
 
188
232
  if not task_id:
189
- typer.echo(__('Task ID is required'))
233
+ typer.echo('Task ID is required')
190
234
  raise typer.Exit(1)
191
235
 
192
236
  service_factory = validate_config_and_get_service_factory()
193
237
  project_service = service_factory.get_project_service()
194
238
 
195
239
  project_service.cancel_task(
196
- task_id=task_id
240
+ task_public_id=task_id
197
241
  )
198
242
 
199
243
  raise typer.Exit(0)
@@ -201,7 +245,20 @@ def cancel_task(
201
245
 
202
246
  @task_app.command("ls", help=__("List tasks"), **get_command_metadata(CliCommand.PROJECT_TASK_LS))
203
247
  def list_runs(
204
- project_uid: Annotated[str, typer.Argument(help=__("Project unique ID. By default, project info is taken from the current directory"), metavar="OPTIONAL")] = None,
248
+ project_public_id: Optional[str] = typer.Option(
249
+ None,
250
+ '--project-id',
251
+ '-pid',
252
+ help=__("Project ID. By default, project info is taken from the current directory"),
253
+ is_eager=False,
254
+ ),
255
+ project_slug: Optional[str] = typer.Option(
256
+ None,
257
+ '--project-name',
258
+ '-pn',
259
+ help=__("Project name. By default, project info is taken from the current directory"),
260
+ is_eager=False,
261
+ ),
205
262
  row: int = typer.Option(
206
263
  5,
207
264
  '--row',
@@ -221,10 +278,14 @@ def list_runs(
221
278
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
222
279
  check_command_permission(command_name)
223
280
 
281
+ if sum(v is not None for v in [project_public_id, project_slug]) > 1:
282
+ typer.echo("Please provide a single identifier for project - ID or name.")
283
+ raise typer.Exit(1)
284
+
224
285
  service_factory = validate_config_and_get_service_factory()
225
286
  project_service: ProjectService = service_factory.get_project_service()
226
287
 
227
- project_service.print_task_list(project_uid, row, page)
288
+ project_service.print_task_list(project_public_id=project_public_id, project_slug=project_slug, row=row, page=page)
228
289
 
229
290
  typer.echo(__("Tasks listing complete"))
230
291
  raise typer.Exit(0)
@@ -232,7 +293,7 @@ def list_runs(
232
293
 
233
294
  @task_app.command(name="logs", no_args_is_help=True, help=__("Stream real-time task logs or view last logs for a task"), **get_command_metadata(CliCommand.PROJECT_TASK_LOGS))
234
295
  def task_logs(
235
- task_id: Optional[int] = typer.Argument(help=__("Task ID"),),
296
+ task_id: Optional[str] = typer.Argument(help=__("Task ID"),),
236
297
  logs_number: Optional[int] = typer.Option(
237
298
  None,
238
299
  '--number',
@@ -253,9 +314,9 @@ def task_logs(
253
314
  logging_service: LoggingService = service_factory.get_logging_service()
254
315
 
255
316
  if logs_number is None:
256
- logging_service.stream_task_logs_with_controls(task_id=task_id)
317
+ logging_service.stream_task_logs_with_controls(task_public_id=task_id)
257
318
  else:
258
- logging_service.print_last_task_logs(task_id=task_id, logs_number=logs_number)
319
+ logging_service.print_last_task_logs(task_public_id=task_id, logs_number=logs_number)
259
320
 
260
321
  app_logger.info(f'Task logs - end')
261
322
  raise typer.Exit(0)
@@ -263,8 +324,19 @@ def task_logs(
263
324
 
264
325
  @app.command(name='checkout', no_args_is_help=True, help=__("Checkout project repository to a specific reference"), **get_command_metadata(CliCommand.PROJECT_CHECKOUT))
265
326
  def checkout_project(
266
- reference: Optional[str] = typer.Argument(
267
- help=__("Task ID or branch name to checkout. '/' will try to identify the main branch."),
327
+ task_public_id: Optional[str] = typer.Option(
328
+ None,
329
+ "--task-id",
330
+ "-tid",
331
+ help="Task ID to checkout",
332
+ is_eager=False,
333
+ ),
334
+ branch_name: Optional[str] = typer.Option(
335
+ None,
336
+ "--branch",
337
+ "-b",
338
+ help="Branch name to checkout. Use '/' value to checkout to the main branch.",
339
+ is_eager=False,
268
340
  ),
269
341
  working_directory: Optional[str] = typer.Option(
270
342
  None,
@@ -278,22 +350,20 @@ def checkout_project(
278
350
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
279
351
  check_command_permission(command_name)
280
352
 
353
+ if sum(v is not None for v in [branch_name, task_public_id]) != 1:
354
+ typer.echo("Please provide a single identifier for checkout - task ID or branch name.")
355
+ raise typer.Exit(1)
356
+
281
357
  service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
282
358
  project_service = service_factory.get_project_service()
283
359
 
284
- task_id: Optional[int] = None
285
- branch_name: Optional[str] = None
286
-
287
- if reference == "/":
288
- pass
289
- elif reference.isdigit():
290
- task_id = int(reference)
291
- else:
292
- branch_name = reference
360
+ final_branch_name = branch_name
361
+ if branch_name == "/":
362
+ final_branch_name = None
293
363
 
294
364
  project_service.checkout_project(
295
- task_id=task_id,
296
- branch_name=branch_name,
365
+ task_public_id=task_public_id,
366
+ branch_name=final_branch_name,
297
367
  )
298
368
 
299
369
  raise typer.Exit(0)
@@ -345,9 +415,20 @@ def reset_project(
345
415
 
346
416
  @config_app.command(name='set-default-container', no_args_is_help=True, help=__("Set default docker container for a project installation"), **get_command_metadata(CliCommand.PROJECT_CONFIG_SET_DEFAULT_CONTAINER))
347
417
  def set_default_container(
348
- container_uid: Annotated[Optional[str], typer.Argument(
349
- help=__("Unique ID of the container to use by default for running tasks"),
350
- )] = None,
418
+ docker_container_public_id: Optional[str] = typer.Option(
419
+ None,
420
+ '--container-id',
421
+ '-cid',
422
+ help=__("Docker container ID"),
423
+ is_eager=False,
424
+ ),
425
+ docker_container_slug: Optional[str] = typer.Option(
426
+ None,
427
+ '--container-name',
428
+ '-cn',
429
+ help=__("Docker container name"),
430
+ is_eager=False,
431
+ ),
351
432
  unset_default_container: Optional[bool] = typer.Option(
352
433
  False,
353
434
  "--unset",
@@ -367,20 +448,26 @@ def set_default_container(
367
448
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
368
449
  check_command_permission(command_name)
369
450
 
451
+ container_args_count = sum(v is not None for v in [docker_container_public_id, docker_container_slug])
452
+ if container_args_count > 1:
453
+ typer.echo("Please provide a single identifier for the container - name or ID.")
454
+ raise typer.Exit(1)
455
+
370
456
  service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
371
457
 
372
- if unset_default_container and container_uid:
373
- typer.echo("Container unique ID is provided along with unset flag. Please pick one.")
458
+ if unset_default_container and container_args_count > 0:
459
+ typer.echo("Container identifier is provided along with unset flag. Please pick one.")
374
460
  raise typer.Exit(1)
375
461
 
376
- if not unset_default_container and not container_uid:
377
- typer.echo("Provide container unique ID or use '--unset' flag")
462
+ if not unset_default_container and container_args_count != 1:
463
+ typer.echo("Provide container identifier or use '--unset' flag")
378
464
  raise typer.Exit(1)
379
465
 
380
466
  project_service = service_factory.get_project_service()
381
467
 
382
468
  project_service.set_default_container(
383
- container_uid=container_uid,
469
+ container_public_id=docker_container_public_id,
470
+ container_slug=docker_container_slug,
384
471
  )
385
472
 
386
473
  raise typer.Exit(0)
@@ -410,18 +497,32 @@ def get_project_config(
410
497
 
411
498
  @inference_simulators_app.command(name='run', no_args_is_help=True, help="Run an inference simulator within the project", **get_command_metadata(CliCommand.PROJECT_INFERENCE_SIMULATOR_RUN))
412
499
  def run_inference_simulator(
413
- rented_instance_unique_id: Optional[str] = typer.Option(
500
+ rented_instance_public_id: Optional[str] = typer.Option(
501
+ None,
502
+ '--rented-instance-id',
503
+ '-rid',
504
+ help=__("The rented instance ID on which the inference simulator will run"),
505
+ is_eager=False,
506
+ ),
507
+ rented_instance_slug: Optional[str] = typer.Option(
508
+ None,
509
+ '--rented-instance-name',
510
+ '-rn',
511
+ help=__("The rented instance name on which the inference simulator will run"),
512
+ is_eager=False,
513
+ ),
514
+ self_hosted_instance_public_id: Optional[str] = typer.Option(
414
515
  None,
415
- '--rented-instance-unique-id',
416
- '-ruid',
417
- help=__("The rented instance unique ID on which the inference simulator will run"),
516
+ '--self-hosted-instance-id',
517
+ '-sid',
518
+ help=__("The self-hosted instance ID on which the inference simulator will run"),
418
519
  is_eager=False,
419
520
  ),
420
- self_hosted_instance_unique_id: Optional[str] = typer.Option(
521
+ self_hosted_instance_slug: Optional[str] = typer.Option(
421
522
  None,
422
- '--self-hosted-instance-unique-id',
423
- '-suid',
424
- help=__("The self-hosted instance unique ID on which the inference simulator will run"),
523
+ '--self-hosted-instance-name',
524
+ '-sn',
525
+ help=__("The self-hosted instance name on which the inference simulator will run"),
425
526
  is_eager=False,
426
527
  ),
427
528
  commit_hash: Optional[str] = typer.Option(
@@ -508,8 +609,10 @@ def run_inference_simulator(
508
609
 
509
610
  inference_simulator = project_service.project_run_inference_simulator(
510
611
  commit_hash=commit_hash,
511
- rented_instance_unique_id=rented_instance_unique_id,
512
- self_hosted_instance_unique_id=self_hosted_instance_unique_id,
612
+ rented_instance_public_id=rented_instance_public_id,
613
+ rented_instance_slug=rented_instance_slug,
614
+ self_hosted_instance_public_id=self_hosted_instance_public_id,
615
+ self_hosted_instance_slug=self_hosted_instance_slug,
513
616
  inference_dir=inference_dir,
514
617
  is_skip_installation=is_skip_installation,
515
618
  files_to_add=files_to_add,
@@ -520,14 +623,27 @@ def run_inference_simulator(
520
623
  logging_service: LoggingService = service_factory.get_logging_service()
521
624
 
522
625
  logging_service.stream_inference_simulator_logs_with_controls(
523
- slug=inference_simulator.slug
626
+ public_id=inference_simulator.public_id
524
627
  )
525
628
  raise typer.Exit(0)
526
629
 
527
630
 
528
631
  @inference_simulators_app.command(name='save-metadata', no_args_is_help=True, help="Get and save inference simulator metadata", **get_command_metadata(CliCommand.PROJECT_INFERENCE_SIMULATOR_SAVE_METADATA))
529
632
  def get_and_save_inference_simulator_metadata(
530
- unique_id: Optional[str] = typer.Argument(help=__("Inference simulator unique ID"),),
633
+ inference_simulator_public_id: Optional[str] = typer.Option(
634
+ None,
635
+ '--inference-simulator-id',
636
+ '-isid',
637
+ help=__("Inference simulator ID"),
638
+ is_eager=False,
639
+ ),
640
+ inference_simulator_slug: Optional[str] = typer.Option(
641
+ None,
642
+ '--inference-simulator-name',
643
+ '-isn',
644
+ help=__("Inference simulator ID"),
645
+ is_eager=False,
646
+ ),
531
647
  file_path: Optional[str] = typer.Option(
532
648
  None,
533
649
  "--file-path",
@@ -541,12 +657,17 @@ def get_and_save_inference_simulator_metadata(
541
657
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
542
658
  check_command_permission(command_name)
543
659
 
660
+ if sum(v is not None for v in [inference_simulator_public_id, inference_simulator_slug]) != 1:
661
+ typer.echo("Please provide a single identifier for inference simulator - ID or name.")
662
+ raise typer.Exit(1)
663
+
544
664
  service_factory = validate_config_and_get_service_factory()
545
665
  project_service = service_factory.get_project_service()
546
666
 
547
667
  project_service.project_get_and_save_inference_simulator_metadata(
548
668
  file_path=file_path,
549
- slug=unique_id,
669
+ inference_simulator_public_id=inference_simulator_public_id,
670
+ inference_simulator_slug=inference_simulator_slug,
550
671
  )
551
672
 
552
673
  raise typer.Exit(0)
@@ -554,17 +675,35 @@ def get_and_save_inference_simulator_metadata(
554
675
 
555
676
  @inference_simulators_app.command(name='push', no_args_is_help=True, help="Push an inference simulator within the project to model registry", **get_command_metadata(CliCommand.PROJECT_INFERENCE_SIMULATOR_PUSH))
556
677
  def push_inference_simulator(
557
- unique_id: Optional[str] = typer.Argument(help=__("Inference simulator unique ID"),),
678
+ inference_simulator_public_id: Optional[str] = typer.Option(
679
+ None,
680
+ '--inference-simulator-id',
681
+ '-isid',
682
+ help=__("Inference simulator ID"),
683
+ is_eager=False,
684
+ ),
685
+ inference_simulator_slug: Optional[str] = typer.Option(
686
+ None,
687
+ '--inference-simulator-name',
688
+ '-isn',
689
+ help=__("Inference simulator name"),
690
+ is_eager=False,
691
+ ),
558
692
  ):
559
693
  command_name = CliCommand.PROJECT_INFERENCE_SIMULATOR_PUSH
560
694
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
561
695
  check_command_permission(command_name)
562
696
 
697
+ if sum(v is not None for v in [inference_simulator_public_id, inference_simulator_slug]) != 1:
698
+ typer.echo("Please provide a single identifier for inference simulator - ID or name.")
699
+ raise typer.Exit(1)
700
+
563
701
  service_factory = validate_config_and_get_service_factory()
564
702
  project_service = service_factory.get_project_service()
565
703
 
566
704
  project_service.project_push_inference_simulator(
567
- slug=unique_id,
705
+ public_id=inference_simulator_public_id,
706
+ slug=inference_simulator_slug,
568
707
  )
569
708
 
570
709
  raise typer.Exit(0)
@@ -572,7 +711,20 @@ def push_inference_simulator(
572
711
 
573
712
  @inference_simulators_app.command("ls", help=__("List inference simulators"), **get_command_metadata(CliCommand.PROJECT_INFERENCE_SIMULATOR_LS))
574
713
  def list_inference_simulators(
575
- project_uid: Annotated[str, typer.Argument(help=__("Project unique ID. By default, project info is taken from the current directory"), metavar="OPTIONAL")] = None,
714
+ project_public_id: Optional[str] = typer.Option(
715
+ None,
716
+ '--project-id',
717
+ '-pid',
718
+ help=__("Project ID. By default, project info is taken from the current directory"),
719
+ is_eager=False,
720
+ ),
721
+ project_slug: Optional[str] = typer.Option(
722
+ None,
723
+ '--project-name',
724
+ '-pn',
725
+ help=__("Project name. By default, project info is taken from the current directory"),
726
+ is_eager=False,
727
+ ),
576
728
  row: int = typer.Option(
577
729
  5,
578
730
  '--row',
@@ -599,10 +751,20 @@ def list_inference_simulators(
599
751
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
600
752
  check_command_permission(command_name)
601
753
 
754
+ if sum(v is not None for v in [project_public_id, project_slug]) > 1:
755
+ typer.echo("Please provide a single identifier for project - ID or name.")
756
+ raise typer.Exit(1)
757
+
602
758
  service_factory = validate_config_and_get_service_factory()
603
759
  project_service: ProjectService = service_factory.get_project_service()
604
760
 
605
- project_service.print_inference_simulator_list(project_uid, statuses, row, page)
761
+ project_service.print_inference_simulator_list(
762
+ project_public_id=project_public_id,
763
+ project_slug=project_slug,
764
+ statuses=statuses,
765
+ row=row,
766
+ page=page
767
+ )
606
768
 
607
769
  typer.echo(__("Inference simulators listing complete"))
608
770
  raise typer.Exit(0)
@@ -610,7 +772,20 @@ def list_inference_simulators(
610
772
 
611
773
  @inference_simulator_model_app.command("ls", help=__("List inference simulator models"), **get_command_metadata(CliCommand.PROJECT_MODEL_LS))
612
774
  def list_inference_simulator_models(
613
- project_uid: Annotated[str, typer.Argument(help=__("Project unique ID. By default, project info is taken from the current directory"), metavar="OPTIONAL")] = None,
775
+ project_public_id: Optional[str] = typer.Option(
776
+ None,
777
+ '--project-id',
778
+ '-pid',
779
+ help=__("Project ID. By default, project info is taken from the current directory"),
780
+ is_eager=False,
781
+ ),
782
+ project_slug: Optional[str] = typer.Option(
783
+ None,
784
+ '--project-name',
785
+ '-pn',
786
+ help=__("Project name. By default, project info is taken from the current directory"),
787
+ is_eager=False,
788
+ ),
614
789
  row: int = typer.Option(
615
790
  5,
616
791
  '--row',
@@ -637,10 +812,20 @@ def list_inference_simulator_models(
637
812
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
638
813
  check_command_permission(command_name)
639
814
 
815
+ if sum(v is not None for v in [project_public_id, project_slug]) > 1:
816
+ typer.echo("Please provide a single identifier for project - ID or name.")
817
+ raise typer.Exit(1)
818
+
640
819
  service_factory = validate_config_and_get_service_factory()
641
820
  project_service: ProjectService = service_factory.get_project_service()
642
821
 
643
- project_service.print_inference_simulator_model_list(project_uid, statuses, row, page)
822
+ project_service.print_inference_simulator_model_list(
823
+ project_public_id=project_public_id,
824
+ project_slug=project_slug,
825
+ statuses=statuses,
826
+ row=row,
827
+ page=page
828
+ )
644
829
 
645
830
  typer.echo(__("Inference simulator models listing complete"))
646
831
  raise typer.Exit(0)
@@ -648,7 +833,20 @@ def list_inference_simulator_models(
648
833
 
649
834
  @inference_simulators_app.command(name="logs", no_args_is_help=True, help=__("Stream real-time task logs or view last logs for an inference simulator"), **get_command_metadata(CliCommand.PROJECT_INFERENCE_SIMULATOR_LOGS))
650
835
  def inference_simulator_logs(
651
- unique_id: Optional[str] = typer.Argument(help=__("Inference simulator unique ID"),),
836
+ public_id: Optional[str] = typer.Option(
837
+ None,
838
+ '--inference-simulator-id',
839
+ '-isid',
840
+ help="Inference simulator ID",
841
+ is_eager=False,
842
+ ),
843
+ slug: Optional[str] = typer.Option(
844
+ None,
845
+ '--name',
846
+ '-isn',
847
+ help="Inference simulator name",
848
+ is_eager=False,
849
+ ),
652
850
  logs_number: Optional[int] = typer.Option(
653
851
  None,
654
852
  '--number',
@@ -661,8 +859,8 @@ def inference_simulator_logs(
661
859
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
662
860
  check_command_permission(command_name)
663
861
 
664
- if not unique_id:
665
- typer.echo(__('Inference simulator UID is required'))
862
+ if sum(v is not None for v in [public_id, slug]) != 1:
863
+ typer.echo("Please provide a single identifier for inference simulator - ID or name.")
666
864
  raise typer.Exit(1)
667
865
 
668
866
  service_factory = validate_config_and_get_service_factory()
@@ -670,18 +868,20 @@ def inference_simulator_logs(
670
868
 
671
869
  if logs_number is None:
672
870
  logging_service.stream_inference_simulator_logs_with_controls(
673
- slug=unique_id
871
+ public_id=public_id,
872
+ slug=slug,
674
873
  )
675
874
  else:
676
875
  get_inference_simulator_response: Optional[GetInferenceSimulatorResponse] = service_factory.get_thestage_api_client().get_inference_simulator(
677
- slug=unique_id,
876
+ public_id=public_id,
877
+ slug=slug,
678
878
  )
679
879
  if not get_inference_simulator_response:
680
- typer.echo(__("Inference simulator with UID %uid% not found", {"uid": unique_id}))
880
+ typer.echo("Inference simulator with not found")
681
881
  raise typer.Exit(1)
682
882
  else:
683
- inference_simulator_id = get_inference_simulator_response.inferenceSimulator.id
684
- logging_service.print_last_inference_simulator_logs(inference_simulator_id=inference_simulator_id, logs_number=logs_number)
883
+ inference_simulator_public_id = get_inference_simulator_response.inferenceSimulator.public_id
884
+ logging_service.print_last_inference_simulator_logs(inference_simulator_public_id=inference_simulator_public_id, logs_number=logs_number)
685
885
 
686
886
  app_logger.info(f'Inference simulator logs - end')
687
887
  raise typer.Exit(0)
@@ -689,19 +889,46 @@ def inference_simulator_logs(
689
889
 
690
890
  @inference_simulator_model_app.command("deploy-instance", no_args_is_help=True, help=__("Deploy an inference simulator model to an instance"), **get_command_metadata(CliCommand.PROJECT_MODEL_DEPLOY_INSTANCE))
691
891
  def deploy_inference_simulator_model_to_instance(
692
- unique_id: Optional[str] = typer.Argument(help=__("Inference simulator model unique ID"), ),
693
- rented_instance_unique_id: Optional[str] = typer.Option(
892
+ model_public_id: Optional[str] = typer.Option(
893
+ None,
894
+ '--model-id',
895
+ '-mid',
896
+ help="The inference simulator model ID",
897
+ is_eager=False,
898
+ ),
899
+ model_slug: Optional[str] = typer.Option(
900
+ None,
901
+ '--model-name',
902
+ '-mn',
903
+ help="The inference simulator model name",
904
+ is_eager=False,
905
+ ),
906
+ rented_instance_public_id: Optional[str] = typer.Option(
694
907
  None,
695
- '--rented-instance-unique-id',
696
- '-ruid',
697
- help=__("The rented instance unique ID on which the inference simulator model will be deployed"),
908
+ '--rented-instance-id',
909
+ '-rid',
910
+ help=__("The rented instance ID on which the inference simulator will run"),
698
911
  is_eager=False,
699
912
  ),
700
- self_hosted_instance_unique_id: Optional[str] = typer.Option(
913
+ rented_instance_slug: Optional[str] = typer.Option(
701
914
  None,
702
- '--self-hosted-instance-unique-id',
703
- '-suid',
704
- help=__("The self-hosted instance unique ID on which the inference simulator model will be deployed"),
915
+ '--rented-instance-name',
916
+ '-rn',
917
+ help=__("The rented instance name on which the inference simulator will run"),
918
+ is_eager=False,
919
+ ),
920
+ self_hosted_instance_public_id: Optional[str] = typer.Option(
921
+ None,
922
+ '--self-hosted-instance-id',
923
+ '-sid',
924
+ help=__("The self-hosted instance ID on which the inference simulator will run"),
925
+ is_eager=False,
926
+ ),
927
+ self_hosted_instance_slug: Optional[str] = typer.Option(
928
+ None,
929
+ '--self-hosted-instance-name',
930
+ '-sn',
931
+ help=__("The self-hosted instance name on which the inference simulator will run"),
705
932
  is_eager=False,
706
933
  ),
707
934
  working_directory: Optional[str] = typer.Option(
@@ -724,33 +951,49 @@ def deploy_inference_simulator_model_to_instance(
724
951
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
725
952
  check_command_permission(command_name)
726
953
 
727
- if unique_id and not re.match(r"^[a-zA-Z0-9-]+$", unique_id):
954
+ if model_slug and not re.match(r"^[a-zA-Z0-9-]+$", model_slug):
728
955
  raise typer.BadParameter(__("Invalid UID format. The UID can only contain letters, numbers, and hyphens."))
729
956
 
730
- unique_id_with_timestamp = f"{unique_id}-{int(time.time())}"
957
+ new_inference_simulator_slug = f"{model_slug}-{int(time.time())}"
731
958
 
732
959
  service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
733
960
  project_service = service_factory.get_project_service()
734
961
 
735
962
  project_service.project_deploy_inference_simulator_model_to_instance(
736
- unique_id=unique_id,
737
- unique_id_with_timestamp=unique_id_with_timestamp,
738
- rented_instance_unique_id=rented_instance_unique_id,
739
- self_hosted_instance_unique_id=self_hosted_instance_unique_id,
963
+ model_public_id=model_public_id,
964
+ model_slug=model_slug,
965
+ new_inference_simulator_slug=new_inference_simulator_slug,
966
+ rented_instance_public_id=rented_instance_public_id,
967
+ rented_instance_slug=rented_instance_slug,
968
+ self_hosted_instance_public_id=self_hosted_instance_public_id,
969
+ self_hosted_instance_slug=self_hosted_instance_slug,
740
970
  )
741
971
 
742
972
  if enable_log_stream:
743
973
  logging_service: LoggingService = service_factory.get_logging_service()
744
974
 
745
975
  logging_service.stream_inference_simulator_logs_with_controls(
746
- slug=unique_id_with_timestamp
976
+ slug=new_inference_simulator_slug
747
977
  )
748
978
  raise typer.Exit(0)
749
979
 
750
980
 
751
981
  @inference_simulator_model_app.command("deploy-sagemaker", no_args_is_help=True, help=__("Deploy an inference simulator model to SageMaker"), **get_command_metadata(CliCommand.PROJECT_MODEL_DEPLOY_SAGEMAKER))
752
982
  def deploy_inference_simulator_model_to_sagemaker(
753
- unique_id: Optional[str] = typer.Argument(help=__("Inference simulator model unique ID"), ),
983
+ model_public_id: Optional[str] = typer.Option(
984
+ None,
985
+ '--id',
986
+ '-mid',
987
+ help="Inference simulator model ID",
988
+ is_eager=False,
989
+ ),
990
+ model_slug: Optional[str] = typer.Option(
991
+ None,
992
+ '--name',
993
+ '-mn',
994
+ help="Inference simulator model name",
995
+ is_eager=False,
996
+ ),
754
997
  arn: Optional[str] = typer.Option(
755
998
  None,
756
999
  '--amazon-resource-name',
@@ -795,14 +1038,19 @@ def deploy_inference_simulator_model_to_sagemaker(
795
1038
  app_logger.info(f'Running {command_name} from {get_current_directory()}')
796
1039
  check_command_permission(command_name)
797
1040
 
798
- if unique_id and not re.match(r"^[a-zA-Z0-9-]+$", unique_id):
1041
+ if sum(v is not None for v in [model_public_id, model_slug]) != 1:
1042
+ typer.echo("Please provide a single identifier for inference simulator model - ID or name.")
1043
+ raise typer.Exit(1)
1044
+
1045
+ if model_slug and not re.match(r"^[a-zA-Z0-9-]+$", model_slug):
799
1046
  raise typer.BadParameter(__("Invalid UID format. The UID can only contain letters, numbers, and hyphens."))
800
1047
 
801
1048
  service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
802
1049
  project_service = service_factory.get_project_service()
803
1050
 
804
1051
  project_service.project_deploy_inference_simulator_model_to_sagemaker(
805
- unique_id=unique_id,
1052
+ model_public_id=model_public_id,
1053
+ model_slug=model_slug,
806
1054
  arn=arn,
807
1055
  instance_type=instance_type,
808
1056
  initial_variant_weight=initial_variant_weight,