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.
- 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 +147 -49
- thestage/controllers/instance_controller.py +35 -9
- thestage/controllers/project_controller.py +334 -86
- thestage/entities/container.py +5 -3
- thestage/entities/project_inference_simulator.py +2 -1
- thestage/entities/project_inference_simulator_model.py +1 -1
- 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 +3 -3
- thestage/services/clients/git/git_client.py +8 -12
- thestage/services/clients/thestage_api/api_client.py +144 -109
- thestage/services/clients/thestage_api/dtos/base_controller/connect_resolve_response.py +21 -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 +7 -1
- thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_response.py +0 -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_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 +76 -73
- thestage/services/container/container_service.py +23 -19
- 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 +40 -40
- 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 +3 -2
- thestage/services/project/mapper/project_inference_simulator_mapper.py +1 -0
- thestage/services/project/mapper/project_inference_simulator_model_mapper.py +3 -3
- thestage/services/project/mapper/project_task_mapper.py +2 -3
- thestage/services/project/project_service.py +161 -131
- thestage/services/remote_server_service.py +1 -0
- thestage/services/task/dto/task_dto.py +3 -23
- {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info}/METADATA +3 -2
- {thestage-0.6.4.dist-info → thestage-0.6.6.dist-info}/RECORD +63 -72
- {thestage-0.6.4.dist-info → thestage-0.6.6.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.4.dist-info → thestage-0.6.6.dist-info}/entry_points.txt +0 -0
- {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
|
-
|
|
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,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(
|
|
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=
|
|
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
|
-
|
|
66
|
-
|
|
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=
|
|
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
|
-
|
|
139
|
+
docker_container_public_id: Optional[str] = typer.Option(
|
|
108
140
|
None,
|
|
109
|
-
'--container-
|
|
141
|
+
'--container-id',
|
|
110
142
|
'-cid',
|
|
111
|
-
help=__("Docker container
|
|
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(
|
|
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[
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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[
|
|
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(
|
|
317
|
+
logging_service.stream_task_logs_with_controls(task_public_id=task_id)
|
|
257
318
|
else:
|
|
258
|
-
logging_service.print_last_task_logs(
|
|
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
|
-
|
|
267
|
-
|
|
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
|
-
|
|
285
|
-
branch_name
|
|
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
|
-
|
|
296
|
-
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
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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
|
|
373
|
-
typer.echo("Container
|
|
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
|
|
377
|
-
typer.echo("Provide container
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
'--
|
|
416
|
-
'-
|
|
417
|
-
help=__("The
|
|
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
|
-
|
|
521
|
+
self_hosted_instance_slug: Optional[str] = typer.Option(
|
|
421
522
|
None,
|
|
422
|
-
'--self-hosted-instance-
|
|
423
|
-
'-
|
|
424
|
-
help=__("The self-hosted instance
|
|
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
|
-
|
|
512
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
|
665
|
-
typer.echo(
|
|
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
|
-
|
|
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
|
-
|
|
876
|
+
public_id=public_id,
|
|
877
|
+
slug=slug,
|
|
678
878
|
)
|
|
679
879
|
if not get_inference_simulator_response:
|
|
680
|
-
typer.echo(
|
|
880
|
+
typer.echo("Inference simulator with not found")
|
|
681
881
|
raise typer.Exit(1)
|
|
682
882
|
else:
|
|
683
|
-
|
|
684
|
-
logging_service.print_last_inference_simulator_logs(
|
|
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
|
-
|
|
693
|
-
|
|
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-
|
|
696
|
-
'-
|
|
697
|
-
help=__("The rented instance
|
|
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
|
-
|
|
913
|
+
rented_instance_slug: Optional[str] = typer.Option(
|
|
701
914
|
None,
|
|
702
|
-
'--
|
|
703
|
-
'-
|
|
704
|
-
help=__("The
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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=
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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,
|