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