thestage 0.6.7__py3-none-any.whl → 0.7.0__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/cli_command.py +3 -0
- thestage/cli_command_helper.py +2 -2
- thestage/config/__init__.py +1 -1
- thestage/{services → config/business}/app_config_service.py +3 -4
- thestage/{services/config_provider → config/business}/config_provider.py +6 -5
- thestage/config/{config_storage.py → business/config_storage.py} +1 -1
- thestage/{services → config/business}/validation_service.py +9 -10
- thestage/{controllers/config_controller.py → config/communication/config_command.py} +7 -7
- thestage/{services/connect → connect/business}/connect_service.py +22 -19
- thestage/{services → connect/business}/remote_server_service.py +4 -5
- thestage/connect/communication/connect_api_client.py +84 -0
- thestage/{services/clients/thestage_api/dtos/ssh_key_controller → connect/dto}/add_ssh_key_to_user_response.py +0 -1
- thestage/{services/clients/thestage_api/dtos/ssh_key_controller → connect/dto}/add_ssh_public_key_to_instance_response.py +1 -4
- thestage/{services/clients/thestage_api/dtos/base_controller → connect/dto}/connect_resolve_response.py +0 -1
- thestage/controllers/base_controller.py +2 -2
- thestage/debug_main.dist.py +16 -14
- thestage/{services/container → docker_container/business}/container_service.py +147 -22
- thestage/{services/container → docker_container/business}/mapper/container_mapper.py +3 -3
- thestage/docker_container/business/mapper/image_mapper.py +16 -0
- thestage/docker_container/communication/__init__.py +0 -0
- thestage/{controllers/container_controller.py → docker_container/communication/docker_command.py} +192 -29
- thestage/docker_container/communication/docker_container_api_client.py +139 -0
- thestage/docker_container/communication/image_command.py +40 -0
- thestage/docker_container/dto/__init__.py +0 -0
- thestage/docker_container/dto/container_action_request.py +11 -0
- thestage/{services/clients/thestage_api/dtos → docker_container/dto}/container_response.py +11 -4
- thestage/docker_container/dto/docker_container_create_request.py +28 -0
- thestage/docker_container/dto/docker_container_create_response.py +11 -0
- thestage/{services/clients/thestage_api/dtos/docker_container_controller → docker_container/dto}/docker_container_list_response.py +3 -5
- thestage/docker_container/dto/docker_image_list_request.py +11 -0
- thestage/docker_container/dto/docker_image_list_response.py +13 -0
- thestage/docker_container/dto/enum/__init__.py +0 -0
- thestage/docker_container/dto/image_entity.py +14 -0
- thestage/git/__init__.py +0 -0
- thestage/git/business/__init__.py +0 -0
- thestage/git/communication/__init__.py +0 -0
- thestage/{services/clients/git → git/communication}/git_client.py +4 -4
- thestage/global_dto/__init__.py +0 -0
- thestage/global_dto/enums/__init__.py +0 -0
- thestage/helpers/error_handler.py +4 -4
- thestage/helpers/logger/app_logger.py +1 -3
- thestage/i18n/en_GB/messages.po +14 -14
- thestage/inference_model/__init__.py +0 -0
- thestage/inference_model/business/__init__.py +0 -0
- thestage/inference_model/business/inference_model_service.py +281 -0
- thestage/inference_model/business/mapper/__init__.py +0 -0
- thestage/{services/project/mapper/project_inference_simulator_model_mapper.py → inference_model/business/mapper/inference_model_mapper.py} +5 -5
- thestage/inference_model/communication/__init__.py +0 -0
- thestage/inference_model/communication/inference_model_api_client.py +139 -0
- thestage/inference_model/communication/inference_model_command.py +246 -0
- thestage/inference_model/dto/__init__.py +0 -0
- thestage/{services/clients/thestage_api/dtos/inference_controller → inference_model/dto}/deploy_inference_model_to_instance_response.py +0 -1
- thestage/inference_model/dto/enum/__init__.py +0 -0
- thestage/{services/project/dto/inference_simulator_model_dto.py → inference_model/dto/inference_model.py} +1 -1
- thestage/{entities/project_inference_simulator_model.py → inference_model/dto/inference_model_entity.py} +1 -1
- thestage/{services/clients/thestage_api/dtos/inference_controller → inference_model/dto}/inference_simulator_model_list_for_project_response.py +2 -3
- thestage/{services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_request.py → inference_model/dto/push_inference_simulator_model_request.py} +1 -1
- thestage/{services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_response.py → inference_model/dto/push_inference_simulator_model_response.py} +1 -1
- thestage/inference_simulator/__init__.py +0 -0
- thestage/inference_simulator/business/__init__.py +0 -0
- thestage/inference_simulator/business/inference_simulator_service.py +338 -0
- thestage/inference_simulator/business/mapper/__init__.py +0 -0
- thestage/{services/project/mapper/project_inference_simulator_mapper.py → inference_simulator/business/mapper/inference_simulator_mapper.py} +5 -5
- thestage/inference_simulator/communication/__init__.py +0 -0
- thestage/inference_simulator/communication/inference_simulator_api_client.py +114 -0
- thestage/inference_simulator/communication/inference_simulator_command.py +347 -0
- thestage/inference_simulator/dto/__init__.py +0 -0
- thestage/inference_simulator/dto/enum/__init__.py +0 -0
- thestage/inference_simulator/dto/get_inference_simulator_response.py +12 -0
- thestage/{services/project/dto/inference_simulator_dto.py → inference_simulator/dto/inference_simulator.py} +1 -1
- thestage/{entities/project_inference_simulator.py → inference_simulator/dto/inference_simulator_entity.py} +1 -1
- thestage/{services/clients/thestage_api/dtos/inference_controller → inference_simulator/dto}/inference_simulator_list_response.py +2 -2
- thestage/{services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_request.py → inference_simulator/dto/start_inference_simulator_request.py} +1 -1
- thestage/inference_simulator/dto/start_inference_simulator_response.py +10 -0
- thestage/instance/__init__.py +0 -0
- thestage/instance/business/__init__.py +0 -0
- thestage/{services/instance → instance/business}/instance_service.py +26 -27
- thestage/instance/business/mapper/__init__.py +0 -0
- thestage/{services/instance/mapper/instance_mapper.py → instance/business/mapper/rented_instance_mapper.py} +3 -3
- thestage/{services/instance/mapper/selfhosted_mapper.py → instance/business/mapper/selfhosted_instance_mapper.py} +5 -7
- thestage/instance/communication/__init__.py +0 -0
- thestage/instance/communication/instance_api_client.py +150 -0
- thestage/{controllers/instance_controller.py → instance/communication/instance_command.py} +5 -5
- thestage/instance/dto/__init__.py +0 -0
- thestage/instance/dto/enum/__init__.py +0 -0
- thestage/{services/clients/thestage_api/dtos → instance/dto}/instance_detected_gpus.py +1 -2
- thestage/{services/clients/thestage_api/dtos → instance/dto}/instance_rented_response.py +2 -2
- thestage/{services/clients/thestage_api/dtos → instance/dto}/selfhosted_instance_response.py +2 -3
- thestage/logging/__init__.py +0 -0
- thestage/logging/business/__init__.py +0 -0
- thestage/{services/logging → logging/business}/logging_service.py +40 -28
- thestage/logging/communication/__init__.py +0 -0
- thestage/logging/communication/logging_api_client.py +63 -0
- thestage/logging/dto/__init__.py +0 -0
- thestage/{services/clients/thestage_api/dtos/logging_controller → logging/dto}/log_polling_response.py +2 -2
- thestage/{services/clients/thestage_api/dtos/logging_controller → logging/dto}/user_logs_query_response.py +2 -2
- thestage/main.py +54 -8
- thestage/project/__init__.py +0 -0
- thestage/project/business/__init__.py +0 -0
- thestage/project/business/project_service.py +480 -0
- thestage/project/communication/__init__.py +0 -0
- thestage/project/communication/project_api_client.py +46 -0
- thestage/project/communication/project_command.py +284 -0
- thestage/project/dto/__init__.py +0 -0
- thestage/services/clients/thestage_api/core/api_client_core.py +1 -1
- thestage/services/clients/thestage_api/dtos/entity_filter_request.py +1 -1
- thestage/services/clients/thestage_api/dtos/sftp_path_helper.py +1 -1
- thestage/services/filesystem_service.py +2 -2
- thestage/services/service_factory.py +130 -43
- thestage/task/__init__.py +0 -0
- thestage/task/business/__init__.py +0 -0
- thestage/task/business/mapper/__init__.py +0 -0
- thestage/{services/project/mapper/project_task_mapper.py → task/business/mapper/task_mapper.py} +5 -5
- thestage/task/business/task_service.py +307 -0
- thestage/task/communication/__init__.py +0 -0
- thestage/task/communication/task_api_client.py +122 -0
- thestage/task/communication/task_command.py +212 -0
- thestage/task/dto/__init__.py +0 -0
- thestage/task/dto/enum/__init__.py +0 -0
- thestage/{services/clients/thestage_api/dtos/task_controller/task_list_for_project_response.py → task/dto/list_for_project_response.py} +2 -2
- thestage/{services/clients/thestage_api/dtos/project_controller/project_run_task_request.py → task/dto/run_task_request.py} +1 -1
- thestage/task/dto/run_task_response.py +13 -0
- thestage/{services/task/dto/task_dto.py → task/dto/task.py} +1 -4
- thestage/{entities/project_task.py → task/dto/task_entity.py} +1 -1
- thestage/{services/clients/thestage_api/dtos/task_controller/task_view_response.py → task/dto/view_response.py} +2 -2
- {thestage-0.6.7.dist-info → thestage-0.7.0.dist-info}/METADATA +1 -1
- thestage-0.7.0.dist-info/RECORD +226 -0
- {thestage-0.6.7.dist-info → thestage-0.7.0.dist-info}/WHEEL +1 -1
- thestage/controllers/project_controller.py +0 -1056
- thestage/services/clients/thestage_api/api_client.py +0 -751
- thestage/services/clients/thestage_api/dtos/container_param_request.py +0 -11
- thestage/services/clients/thestage_api/dtos/inference_controller/get_inference_simulator_response.py +0 -13
- thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_response.py +0 -13
- thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_response.py +0 -10
- thestage/services/clients/thestage_api/dtos/user_controller/user_profile.py +0 -12
- thestage/services/project/project_service.py +0 -1287
- thestage-0.6.7.dist-info/RECORD +0 -167
- /thestage/{entities → color_scheme}/__init__.py +0 -0
- /thestage/{entities/enums → config/business}/__init__.py +0 -0
- /thestage/{services/clients/git → config/communication}/__init__.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → config/dto}/__init__.py +0 -0
- /thestage/{services/core_files → config/dto}/config_entity.py +0 -0
- /thestage/{services/connect → config}/dto/remote_server_config.py +0 -0
- /thestage/{services/config_provider → connect}/__init__.py +0 -0
- /thestage/{services/container → connect/business}/__init__.py +0 -0
- /thestage/{services/container/mapper → connect/communication}/__init__.py +0 -0
- /thestage/{services/instance → connect/dto}/__init__.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/ssh_key_controller → connect/dto}/add_ssh_key_to_user_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/ssh_key_controller → connect/dto}/add_ssh_public_key_to_instance_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/ssh_key_controller → connect/dto}/is_user_has_public_ssh_key_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/ssh_key_controller → connect/dto}/is_user_has_public_ssh_key_response.py +0 -0
- /thestage/{services/instance/mapper → docker_container}/__init__.py +0 -0
- /thestage/{services/project → docker_container/business}/__init__.py +0 -0
- /thestage/{services/project → docker_container/business}/mapper/__init__.py +0 -0
- /thestage/{entities/container.py → docker_container/dto/container_entity.py} +0 -0
- /thestage/{services/clients/thestage_api/dtos/docker_container_controller → docker_container/dto}/docker_container_list_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos → docker_container/dto}/docker_container_mapping.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → docker_container/dto/enum}/container_pending_action.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → docker_container/dto/enum}/container_status.py +0 -0
- /thestage/{services/logging/exception → exceptions}/log_polling_exception.py +0 -0
- /thestage/git/{ProgressPrinter.py → business/ProgressPrinter.py} +0 -0
- /thestage/{entities → global_dto}/enums/order_direction_type.py +0 -0
- /thestage/{entities → global_dto}/enums/shell_type.py +0 -0
- /thestage/{entities → global_dto}/enums/tail_output_type.py +0 -0
- /thestage/{entities → global_dto}/enums/yes_no_response.py +0 -0
- /thestage/{entities → global_dto}/file_item.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/inference_controller → inference_model/dto}/deploy_inference_model_to_instance_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/inference_controller → inference_model/dto}/deploy_inference_model_to_sagemaker_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/inference_controller → inference_model/dto}/deploy_inference_model_to_sagemaker_response.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → inference_model/dto/enum}/inference_model_status.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/inference_controller → inference_model/dto}/inference_simulator_model_list_for_project_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos → inference_model/dto}/inference_simulator_model_response.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → inference_simulator/dto/enum}/inference_simulator_status.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/inference_controller → inference_simulator/dto}/get_inference_simulator_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/inference_controller → inference_simulator/dto}/inference_simulator_list_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos → inference_simulator/dto}/inference_simulator_response.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → instance/dto/enum}/cpu_type.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → instance/dto/enum}/gpu_name.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → instance/dto/enum}/instance_rented_status.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → instance/dto/enum}/provider_name.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → instance/dto/enum}/selfhosted_status.py +0 -0
- /thestage/{entities → instance/dto}/rented_instance.py +0 -0
- /thestage/{entities → instance/dto}/self_hosted_instance.py +0 -0
- /thestage/{services/logging → logging}/byte_print_style.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/logging_controller → logging/dto}/docker_container_log_stream_request.py +0 -0
- /thestage/{services/logging → logging}/dto/log_message.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/logging_controller → logging/dto}/log_polling_request.py +0 -0
- /thestage/{services/logging → logging}/dto/log_type.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/logging_controller → logging/dto}/task_log_stream_request.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/logging_controller → logging/dto}/user_logs_query_request.py +0 -0
- /thestage/{services/logging → logging}/logging_constants.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_request.py → project/dto/get_deploy_ssh_key_request.py} +0 -0
- /thestage/{services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_response.py → project/dto/get_deploy_ssh_key_response.py} +0 -0
- /thestage/{services/project → project}/dto/project_config.py +0 -0
- /thestage/{services/clients/thestage_api/dtos → project/dto}/project_response.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → task/dto/enum}/task_execution_status.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/enums → task/dto/enum}/task_status.py +0 -0
- /thestage/{services/clients/thestage_api/dtos/task_controller/task_list_for_project_request.py → task/dto/list_for_project_request.py} +0 -0
- /thestage/{services/clients/thestage_api/dtos/task_controller/task_status_localized_map_response.py → task/dto/status_localized_map_response.py} +0 -0
- {thestage-0.6.7.dist-info → thestage-0.7.0.dist-info}/entry_points.txt +0 -0
- {thestage-0.6.7.dist-info → thestage-0.7.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1,1056 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Optional, List
|
|
4
|
-
|
|
5
|
-
import re
|
|
6
|
-
|
|
7
|
-
import typer
|
|
8
|
-
from typing_extensions import Annotated
|
|
9
|
-
|
|
10
|
-
from thestage.cli_command import CliCommand
|
|
11
|
-
from thestage.cli_command_helper import get_command_group_help_panel, get_command_metadata, check_command_permission
|
|
12
|
-
from thestage.controllers.utils_controller import validate_config_and_get_service_factory, get_current_directory
|
|
13
|
-
from thestage.helpers.logger.app_logger import app_logger
|
|
14
|
-
from thestage.i18n.translation import __
|
|
15
|
-
from thestage.services.clients.thestage_api.dtos.inference_controller.get_inference_simulator_response import \
|
|
16
|
-
GetInferenceSimulatorResponse
|
|
17
|
-
from thestage.services.logging.logging_service import LoggingService
|
|
18
|
-
from thestage.services.project.project_service import ProjectService
|
|
19
|
-
from thestage.services.task.dto.task_dto import TaskDto
|
|
20
|
-
|
|
21
|
-
app = typer.Typer(no_args_is_help=True, help=__("Manage projects"))
|
|
22
|
-
inference_simulators_app = typer.Typer(no_args_is_help=True, help="Manage project inference simulators")
|
|
23
|
-
inference_simulator_model_app = typer.Typer(no_args_is_help=True, help="Manage project inference simulator models")
|
|
24
|
-
task_app = typer.Typer(no_args_is_help=True, help=__("Manage project tasks"))
|
|
25
|
-
config_app = typer.Typer(no_args_is_help=True, help=__("Manage project config"))
|
|
26
|
-
|
|
27
|
-
app.add_typer(inference_simulators_app, name="inference-simulator", rich_help_panel=get_command_group_help_panel())
|
|
28
|
-
app.add_typer(inference_simulator_model_app, name="model", rich_help_panel=get_command_group_help_panel())
|
|
29
|
-
app.add_typer(task_app, name="task", rich_help_panel=get_command_group_help_panel())
|
|
30
|
-
app.add_typer(config_app, name="config", rich_help_panel=get_command_group_help_panel())
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@app.command(name='clone', no_args_is_help=True, help=__("Clone project repository to empty directory"), **get_command_metadata(CliCommand.PROJECT_CLONE))
|
|
34
|
-
def clone(
|
|
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,
|
|
48
|
-
),
|
|
49
|
-
working_directory: Optional[str] = typer.Option(
|
|
50
|
-
None,
|
|
51
|
-
"--working-directory",
|
|
52
|
-
"-wd",
|
|
53
|
-
help=__("Full path to the working directory: current directory used by default"),
|
|
54
|
-
is_eager=False,
|
|
55
|
-
),
|
|
56
|
-
):
|
|
57
|
-
command_name = CliCommand.PROJECT_CLONE
|
|
58
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
59
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
65
|
-
if not working_directory:
|
|
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)
|
|
68
|
-
|
|
69
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
70
|
-
project_service = service_factory.get_project_service()
|
|
71
|
-
|
|
72
|
-
project_service.clone_project(
|
|
73
|
-
project_slug=project_slug,
|
|
74
|
-
project_public_id=project_public_id,
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
raise typer.Exit(0)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@app.command(name='init', no_args_is_help=True, help=__("Initialize project repository with existing files"), **get_command_metadata(CliCommand.PROJECT_INIT))
|
|
81
|
-
def init(
|
|
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,
|
|
95
|
-
),
|
|
96
|
-
working_directory: Optional[str] = typer.Option(
|
|
97
|
-
None,
|
|
98
|
-
"--working-directory",
|
|
99
|
-
"-wd",
|
|
100
|
-
help=__("Full path to working directory"),
|
|
101
|
-
is_eager=False,
|
|
102
|
-
),
|
|
103
|
-
):
|
|
104
|
-
command_name = CliCommand.PROJECT_INIT
|
|
105
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
106
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
112
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
113
|
-
project_service = service_factory.get_project_service()
|
|
114
|
-
project_config = service_factory.get_config_provider().read_project_config()
|
|
115
|
-
|
|
116
|
-
if project_config:
|
|
117
|
-
typer.echo(__("Directory is initialized and already contains working project"))
|
|
118
|
-
raise typer.Exit(1)
|
|
119
|
-
|
|
120
|
-
project_service.init_project(
|
|
121
|
-
project_slug=project_slug,
|
|
122
|
-
project_public_id=project_public_id,
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
raise typer.Exit(0)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
@app.command(name='run', no_args_is_help=True, help=__("Run a task within the project. By default, it uses the latest commit from the main branch and streams real-time task logs."), **get_command_metadata(CliCommand.PROJECT_RUN))
|
|
129
|
-
def run(
|
|
130
|
-
command: Annotated[List[str], typer.Argument(
|
|
131
|
-
help=__("Command to run (required)"),
|
|
132
|
-
)],
|
|
133
|
-
commit_hash: Optional[str] = typer.Option(
|
|
134
|
-
None,
|
|
135
|
-
'--commit-hash',
|
|
136
|
-
'-hash',
|
|
137
|
-
help=__("Commit hash to use. By default, the current HEAD commit is used."),
|
|
138
|
-
is_eager=False,
|
|
139
|
-
),
|
|
140
|
-
docker_container_public_id: Optional[str] = typer.Option(
|
|
141
|
-
None,
|
|
142
|
-
'--container-id',
|
|
143
|
-
'-cid',
|
|
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"),
|
|
152
|
-
is_eager=False,
|
|
153
|
-
),
|
|
154
|
-
working_directory: Optional[str] = typer.Option(
|
|
155
|
-
None,
|
|
156
|
-
"--working-directory",
|
|
157
|
-
"-wd",
|
|
158
|
-
help=__("Full path to working directory"),
|
|
159
|
-
show_default=False,
|
|
160
|
-
is_eager=False,
|
|
161
|
-
),
|
|
162
|
-
enable_log_stream: Optional[bool] = typer.Option(
|
|
163
|
-
True,
|
|
164
|
-
" /--no-logs",
|
|
165
|
-
" /-nl",
|
|
166
|
-
help=__("Disable real-time log streaming"),
|
|
167
|
-
is_eager=False,
|
|
168
|
-
),
|
|
169
|
-
task_title: Optional[str] = typer.Option(
|
|
170
|
-
None,
|
|
171
|
-
"--title",
|
|
172
|
-
"-t",
|
|
173
|
-
help=__("Provide a custom task title. Git commit message is used by default."),
|
|
174
|
-
is_eager=False,
|
|
175
|
-
),
|
|
176
|
-
files_to_add: Optional[str] = typer.Option(
|
|
177
|
-
None,
|
|
178
|
-
"--files-add",
|
|
179
|
-
"-fa",
|
|
180
|
-
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator."),
|
|
181
|
-
is_eager=False,
|
|
182
|
-
),
|
|
183
|
-
is_skip_auto_commit: Optional[bool] = typer.Option(
|
|
184
|
-
False,
|
|
185
|
-
"--skip-autocommit",
|
|
186
|
-
"-sa",
|
|
187
|
-
help=__("Skip automatic commit of the changes"),
|
|
188
|
-
is_eager=False,
|
|
189
|
-
),
|
|
190
|
-
):
|
|
191
|
-
command_name = CliCommand.PROJECT_RUN
|
|
192
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
193
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
199
|
-
if not command:
|
|
200
|
-
typer.echo(__('Command is required'))
|
|
201
|
-
raise typer.Exit(1)
|
|
202
|
-
|
|
203
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
204
|
-
project_service = service_factory.get_project_service()
|
|
205
|
-
|
|
206
|
-
task: Optional[TaskDto] = project_service.project_run_task(
|
|
207
|
-
run_command=" ".join(command),
|
|
208
|
-
commit_hash=commit_hash,
|
|
209
|
-
docker_container_public_id=docker_container_public_id,
|
|
210
|
-
docker_container_slug=docker_container_slug,
|
|
211
|
-
task_title=task_title,
|
|
212
|
-
files_to_add=files_to_add,
|
|
213
|
-
is_skip_auto_commit=is_skip_auto_commit,
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
if enable_log_stream:
|
|
217
|
-
logging_service: LoggingService = service_factory.get_logging_service()
|
|
218
|
-
logging_service.stream_task_logs_with_controls(task_public_id=task.public_id)
|
|
219
|
-
|
|
220
|
-
raise typer.Exit(0)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
@task_app.command(name='cancel', no_args_is_help=True, help=__("Cancel a task by ID"), **get_command_metadata(CliCommand.PROJECT_TASK_CANCEL))
|
|
224
|
-
def cancel_task(
|
|
225
|
-
task_id: Annotated[str, typer.Argument(
|
|
226
|
-
help=__("Task ID (required)"),
|
|
227
|
-
)],
|
|
228
|
-
):
|
|
229
|
-
command_name = CliCommand.PROJECT_TASK_CANCEL
|
|
230
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
231
|
-
check_command_permission(command_name)
|
|
232
|
-
|
|
233
|
-
if not task_id:
|
|
234
|
-
typer.echo('Task ID is required')
|
|
235
|
-
raise typer.Exit(1)
|
|
236
|
-
|
|
237
|
-
service_factory = validate_config_and_get_service_factory()
|
|
238
|
-
project_service = service_factory.get_project_service()
|
|
239
|
-
|
|
240
|
-
project_service.cancel_task(
|
|
241
|
-
task_public_id=task_id
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
raise typer.Exit(0)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
@task_app.command("ls", help=__("List tasks"), **get_command_metadata(CliCommand.PROJECT_TASK_LS))
|
|
248
|
-
def list_runs(
|
|
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
|
-
),
|
|
263
|
-
row: int = typer.Option(
|
|
264
|
-
5,
|
|
265
|
-
'--row',
|
|
266
|
-
'-r',
|
|
267
|
-
help=__("Set number of rows displayed per page"),
|
|
268
|
-
is_eager=False,
|
|
269
|
-
),
|
|
270
|
-
page: int = typer.Option(
|
|
271
|
-
1,
|
|
272
|
-
'--page',
|
|
273
|
-
'-p',
|
|
274
|
-
help=__("Set starting page for displaying output"),
|
|
275
|
-
is_eager=False,
|
|
276
|
-
),
|
|
277
|
-
):
|
|
278
|
-
command_name = CliCommand.PROJECT_TASK_LS
|
|
279
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
280
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
286
|
-
service_factory = validate_config_and_get_service_factory()
|
|
287
|
-
project_service: ProjectService = service_factory.get_project_service()
|
|
288
|
-
|
|
289
|
-
project_service.print_task_list(project_public_id=project_public_id, project_slug=project_slug, row=row, page=page)
|
|
290
|
-
|
|
291
|
-
typer.echo(__("Tasks listing complete"))
|
|
292
|
-
raise typer.Exit(0)
|
|
293
|
-
|
|
294
|
-
|
|
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))
|
|
296
|
-
def task_logs(
|
|
297
|
-
task_id: Optional[str] = typer.Argument(help=__("Task ID"),),
|
|
298
|
-
logs_number: Optional[int] = typer.Option(
|
|
299
|
-
None,
|
|
300
|
-
'--number',
|
|
301
|
-
'-n',
|
|
302
|
-
help=__("Display a number of latest log entries. No real-time stream if provided."),
|
|
303
|
-
is_eager=False,
|
|
304
|
-
),
|
|
305
|
-
):
|
|
306
|
-
command_name = CliCommand.PROJECT_TASK_LOGS
|
|
307
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
308
|
-
check_command_permission(command_name)
|
|
309
|
-
|
|
310
|
-
if not task_id:
|
|
311
|
-
typer.echo(__('Task ID is required'))
|
|
312
|
-
raise typer.Exit(1)
|
|
313
|
-
|
|
314
|
-
service_factory = validate_config_and_get_service_factory()
|
|
315
|
-
logging_service: LoggingService = service_factory.get_logging_service()
|
|
316
|
-
|
|
317
|
-
if logs_number is None:
|
|
318
|
-
logging_service.stream_task_logs_with_controls(task_public_id=task_id)
|
|
319
|
-
else:
|
|
320
|
-
logging_service.print_last_task_logs(task_public_id=task_id, logs_number=logs_number)
|
|
321
|
-
|
|
322
|
-
app_logger.info(f'Task logs - end')
|
|
323
|
-
raise typer.Exit(0)
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
@app.command(name='checkout', no_args_is_help=True, help=__("Checkout project repository to a specific reference"), **get_command_metadata(CliCommand.PROJECT_CHECKOUT))
|
|
327
|
-
def checkout_project(
|
|
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,
|
|
341
|
-
),
|
|
342
|
-
working_directory: Optional[str] = typer.Option(
|
|
343
|
-
None,
|
|
344
|
-
"--working-directory",
|
|
345
|
-
"-wd",
|
|
346
|
-
help=__("Full path to working directory"),
|
|
347
|
-
is_eager=False,
|
|
348
|
-
),
|
|
349
|
-
):
|
|
350
|
-
command_name = CliCommand.PROJECT_CHECKOUT
|
|
351
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
352
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
358
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
359
|
-
project_service = service_factory.get_project_service()
|
|
360
|
-
|
|
361
|
-
final_branch_name = branch_name
|
|
362
|
-
if branch_name == "/":
|
|
363
|
-
final_branch_name = None
|
|
364
|
-
|
|
365
|
-
project_service.checkout_project(
|
|
366
|
-
task_public_id=task_public_id,
|
|
367
|
-
branch_name=final_branch_name,
|
|
368
|
-
)
|
|
369
|
-
|
|
370
|
-
raise typer.Exit(0)
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
@app.command(name='pull', help=__("Pulls the changes from the remote project repository. Equivalent to 'git pull'."), **get_command_metadata(CliCommand.PROJECT_PULL))
|
|
374
|
-
def pull_project(
|
|
375
|
-
working_directory: Optional[str] = typer.Option(
|
|
376
|
-
None,
|
|
377
|
-
"--working-directory",
|
|
378
|
-
"-wd",
|
|
379
|
-
help=__("Full path to working directory"),
|
|
380
|
-
is_eager=False,
|
|
381
|
-
),
|
|
382
|
-
):
|
|
383
|
-
command_name = CliCommand.PROJECT_PULL
|
|
384
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
385
|
-
check_command_permission(command_name)
|
|
386
|
-
|
|
387
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
388
|
-
project_service = service_factory.get_project_service()
|
|
389
|
-
|
|
390
|
-
project_service.pull_project()
|
|
391
|
-
|
|
392
|
-
raise typer.Exit(0)
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
@app.command(name='reset', help=__("Resets the current project branch to remote counterpart. All working tree changes will be lost. Equivalent to 'git fetch && git reset --hard origin/{ref}'."), **get_command_metadata(CliCommand.PROJECT_RESET))
|
|
396
|
-
def reset_project(
|
|
397
|
-
working_directory: Optional[str] = typer.Option(
|
|
398
|
-
None,
|
|
399
|
-
"--working-directory",
|
|
400
|
-
"-wd",
|
|
401
|
-
help=__("Full path to working directory"),
|
|
402
|
-
is_eager=False,
|
|
403
|
-
),
|
|
404
|
-
):
|
|
405
|
-
command_name = CliCommand.PROJECT_RESET
|
|
406
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
407
|
-
check_command_permission(command_name)
|
|
408
|
-
|
|
409
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
410
|
-
project_service = service_factory.get_project_service()
|
|
411
|
-
|
|
412
|
-
project_service.reset_project()
|
|
413
|
-
|
|
414
|
-
raise typer.Exit(0)
|
|
415
|
-
|
|
416
|
-
|
|
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))
|
|
418
|
-
def set_default_container(
|
|
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
|
-
),
|
|
433
|
-
unset_default_container: Optional[bool] = typer.Option(
|
|
434
|
-
False,
|
|
435
|
-
"--unset",
|
|
436
|
-
"-u",
|
|
437
|
-
help=__("Unsets the default docker container"),
|
|
438
|
-
is_eager=False,
|
|
439
|
-
),
|
|
440
|
-
working_directory: Optional[str] = typer.Option(
|
|
441
|
-
None,
|
|
442
|
-
"--working-directory",
|
|
443
|
-
"-wd",
|
|
444
|
-
help=__("Full path to working directory"),
|
|
445
|
-
is_eager=False,
|
|
446
|
-
),
|
|
447
|
-
):
|
|
448
|
-
command_name = CliCommand.PROJECT_CONFIG_SET_DEFAULT_CONTAINER
|
|
449
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
450
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
457
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
458
|
-
|
|
459
|
-
if unset_default_container and container_args_count > 0:
|
|
460
|
-
typer.echo("Container identifier is provided along with unset flag. Please pick one.")
|
|
461
|
-
raise typer.Exit(1)
|
|
462
|
-
|
|
463
|
-
if not unset_default_container and container_args_count != 1:
|
|
464
|
-
typer.echo("Provide container identifier or use '--unset' flag")
|
|
465
|
-
raise typer.Exit(1)
|
|
466
|
-
|
|
467
|
-
project_service = service_factory.get_project_service()
|
|
468
|
-
|
|
469
|
-
project_service.set_default_container(
|
|
470
|
-
container_public_id=docker_container_public_id,
|
|
471
|
-
container_slug=docker_container_slug,
|
|
472
|
-
)
|
|
473
|
-
|
|
474
|
-
raise typer.Exit(0)
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
@config_app.command(name='get', no_args_is_help=False, help=__("View config for a local project installation"), **get_command_metadata(CliCommand.PROJECT_CONFIG_GET))
|
|
478
|
-
def get_project_config(
|
|
479
|
-
working_directory: Optional[str] = typer.Option(
|
|
480
|
-
None,
|
|
481
|
-
"--working-directory",
|
|
482
|
-
"-wd",
|
|
483
|
-
help=__("Full path to working directory"),
|
|
484
|
-
is_eager=False,
|
|
485
|
-
),
|
|
486
|
-
):
|
|
487
|
-
command_name = CliCommand.PROJECT_CONFIG_GET
|
|
488
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
489
|
-
check_command_permission(command_name)
|
|
490
|
-
|
|
491
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
492
|
-
project_service = service_factory.get_project_service()
|
|
493
|
-
|
|
494
|
-
project_service.print_project_config()
|
|
495
|
-
|
|
496
|
-
raise typer.Exit(0)
|
|
497
|
-
|
|
498
|
-
|
|
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))
|
|
500
|
-
def run_inference_simulator(
|
|
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(
|
|
509
|
-
None,
|
|
510
|
-
'--rented-instance-name',
|
|
511
|
-
'-rn',
|
|
512
|
-
help=__("The rented instance name on which the inference simulator will run"),
|
|
513
|
-
is_eager=False,
|
|
514
|
-
),
|
|
515
|
-
self_hosted_instance_public_id: Optional[str] = typer.Option(
|
|
516
|
-
None,
|
|
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"),
|
|
527
|
-
is_eager=False,
|
|
528
|
-
),
|
|
529
|
-
commit_hash: Optional[str] = typer.Option(
|
|
530
|
-
None,
|
|
531
|
-
'--commit-hash',
|
|
532
|
-
'-hash',
|
|
533
|
-
help=__("Commit hash to use. By default, the current HEAD commit is used."),
|
|
534
|
-
is_eager=False,
|
|
535
|
-
),
|
|
536
|
-
working_directory: Optional[str] = typer.Option(
|
|
537
|
-
None,
|
|
538
|
-
"--working-directory",
|
|
539
|
-
"-wd",
|
|
540
|
-
help=__("Full path to working directory. By default, the current directory is used"),
|
|
541
|
-
show_default=False,
|
|
542
|
-
is_eager=False,
|
|
543
|
-
),
|
|
544
|
-
enable_log_stream: Optional[bool] = typer.Option(
|
|
545
|
-
True,
|
|
546
|
-
" /--no-logs",
|
|
547
|
-
" /-nl",
|
|
548
|
-
help=__("Disable real-time log streaming"),
|
|
549
|
-
is_eager=False,
|
|
550
|
-
),
|
|
551
|
-
is_skip_installation: Optional[bool] = typer.Option(
|
|
552
|
-
False,
|
|
553
|
-
"--skip-installation",
|
|
554
|
-
"-si",
|
|
555
|
-
help=__("Skip installing dependencies from requirements.txt and install.sh"),
|
|
556
|
-
is_eager=False,
|
|
557
|
-
),
|
|
558
|
-
files_to_add: Optional[str] = typer.Option(
|
|
559
|
-
None,
|
|
560
|
-
"--files-add",
|
|
561
|
-
"-fa",
|
|
562
|
-
help=__("Files to add to the commit. You can add files by their relative path from the working directory with a comma as a separator."),
|
|
563
|
-
is_eager=False,
|
|
564
|
-
),
|
|
565
|
-
is_skip_auto_commit: Optional[bool] = typer.Option(
|
|
566
|
-
False,
|
|
567
|
-
"--skip-autocommit",
|
|
568
|
-
"-sa",
|
|
569
|
-
help=__("Skip automatic commit of the changes"),
|
|
570
|
-
is_eager=False,
|
|
571
|
-
),
|
|
572
|
-
):
|
|
573
|
-
command_name = CliCommand.PROJECT_INFERENCE_SIMULATOR_RUN
|
|
574
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
575
|
-
check_command_permission(command_name)
|
|
576
|
-
|
|
577
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
578
|
-
config = service_factory.get_config_provider().get_config()
|
|
579
|
-
|
|
580
|
-
working_dir_path = Path(working_directory) if working_directory else Path(config.runtime.working_directory)
|
|
581
|
-
inference_files = list(working_dir_path.rglob("inference.py"))
|
|
582
|
-
if not inference_files:
|
|
583
|
-
typer.echo("No inference.py file found in the project directory.")
|
|
584
|
-
raise typer.Exit(1)
|
|
585
|
-
elif len(inference_files) == 1:
|
|
586
|
-
selected_inference = inference_files[0]
|
|
587
|
-
else:
|
|
588
|
-
choices = [str(path.relative_to(working_dir_path)) for path in inference_files]
|
|
589
|
-
typer.echo("Multiple inference.py files found:")
|
|
590
|
-
for idx, choice in enumerate(choices, start=1):
|
|
591
|
-
typer.echo(f"{idx}) {choice}")
|
|
592
|
-
choice_str = typer.prompt("Choose which inference.py to use")
|
|
593
|
-
try:
|
|
594
|
-
choice_index = int(choice_str)
|
|
595
|
-
except ValueError:
|
|
596
|
-
raise typer.BadParameter("Invalid input. Please enter a number.")
|
|
597
|
-
if not (1 <= choice_index <= len(choices)):
|
|
598
|
-
raise typer.BadParameter("Choice out of range.")
|
|
599
|
-
selected_inference = inference_files[choice_index - 1]
|
|
600
|
-
|
|
601
|
-
relative_inference = selected_inference.relative_to(working_dir_path)
|
|
602
|
-
parent_dir = relative_inference.parent
|
|
603
|
-
if parent_dir == Path("."):
|
|
604
|
-
inference_dir = "/"
|
|
605
|
-
else:
|
|
606
|
-
inference_dir = f"{parent_dir.as_posix()}/"
|
|
607
|
-
typer.echo(f"Selected inference file relative path: {inference_dir}")
|
|
608
|
-
|
|
609
|
-
project_service = service_factory.get_project_service()
|
|
610
|
-
|
|
611
|
-
inference_simulator = project_service.project_run_inference_simulator(
|
|
612
|
-
commit_hash=commit_hash,
|
|
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,
|
|
617
|
-
inference_dir=inference_dir,
|
|
618
|
-
is_skip_installation=is_skip_installation,
|
|
619
|
-
files_to_add=files_to_add,
|
|
620
|
-
is_skip_auto_commit=is_skip_auto_commit,
|
|
621
|
-
)
|
|
622
|
-
|
|
623
|
-
if enable_log_stream:
|
|
624
|
-
logging_service: LoggingService = service_factory.get_logging_service()
|
|
625
|
-
|
|
626
|
-
logging_service.stream_inference_simulator_logs_with_controls(
|
|
627
|
-
public_id=inference_simulator.public_id
|
|
628
|
-
)
|
|
629
|
-
raise typer.Exit(0)
|
|
630
|
-
|
|
631
|
-
|
|
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))
|
|
633
|
-
def get_and_save_inference_simulator_metadata(
|
|
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
|
-
),
|
|
648
|
-
file_path: Optional[str] = typer.Option(
|
|
649
|
-
None,
|
|
650
|
-
"--file-path",
|
|
651
|
-
"-fp",
|
|
652
|
-
help=__("Full path to a new file. By default metadata is saved to the current directory as metadata.json"),
|
|
653
|
-
show_default=False,
|
|
654
|
-
is_eager=False,
|
|
655
|
-
),
|
|
656
|
-
):
|
|
657
|
-
command_name = CliCommand.PROJECT_INFERENCE_SIMULATOR_SAVE_METADATA
|
|
658
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
659
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
665
|
-
service_factory = validate_config_and_get_service_factory()
|
|
666
|
-
project_service = service_factory.get_project_service()
|
|
667
|
-
|
|
668
|
-
project_service.project_get_and_save_inference_simulator_metadata(
|
|
669
|
-
file_path=file_path,
|
|
670
|
-
inference_simulator_public_id=inference_simulator_public_id,
|
|
671
|
-
inference_simulator_slug=inference_simulator_slug,
|
|
672
|
-
)
|
|
673
|
-
|
|
674
|
-
raise typer.Exit(0)
|
|
675
|
-
|
|
676
|
-
|
|
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))
|
|
678
|
-
def push_inference_simulator(
|
|
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
|
-
),
|
|
693
|
-
):
|
|
694
|
-
command_name = CliCommand.PROJECT_INFERENCE_SIMULATOR_PUSH
|
|
695
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
696
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
702
|
-
service_factory = validate_config_and_get_service_factory()
|
|
703
|
-
project_service = service_factory.get_project_service()
|
|
704
|
-
|
|
705
|
-
project_service.project_push_inference_simulator(
|
|
706
|
-
public_id=inference_simulator_public_id,
|
|
707
|
-
slug=inference_simulator_slug,
|
|
708
|
-
)
|
|
709
|
-
|
|
710
|
-
raise typer.Exit(0)
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
@inference_simulators_app.command("ls", help=__("List inference simulators"), **get_command_metadata(CliCommand.PROJECT_INFERENCE_SIMULATOR_LS))
|
|
714
|
-
def list_inference_simulators(
|
|
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
|
-
),
|
|
729
|
-
row: int = typer.Option(
|
|
730
|
-
5,
|
|
731
|
-
'--row',
|
|
732
|
-
'-r',
|
|
733
|
-
help=__("Set number of rows displayed per page"),
|
|
734
|
-
is_eager=False,
|
|
735
|
-
),
|
|
736
|
-
page: int = typer.Option(
|
|
737
|
-
1,
|
|
738
|
-
'--page',
|
|
739
|
-
'-p',
|
|
740
|
-
help=__("Set starting page for displaying output"),
|
|
741
|
-
is_eager=False,
|
|
742
|
-
),
|
|
743
|
-
statuses: List[str] = typer.Option(
|
|
744
|
-
None,
|
|
745
|
-
'--status',
|
|
746
|
-
'-s',
|
|
747
|
-
help=__("Filter by status, use --status all to list all inference simulators"),
|
|
748
|
-
is_eager=False,
|
|
749
|
-
),
|
|
750
|
-
):
|
|
751
|
-
command_name = CliCommand.PROJECT_INFERENCE_SIMULATOR_LS
|
|
752
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
753
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
759
|
-
service_factory = validate_config_and_get_service_factory()
|
|
760
|
-
project_service: ProjectService = service_factory.get_project_service()
|
|
761
|
-
|
|
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
|
-
)
|
|
769
|
-
|
|
770
|
-
typer.echo(__("Inference simulators listing complete"))
|
|
771
|
-
raise typer.Exit(0)
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
@inference_simulator_model_app.command("ls", help=__("List inference simulator models"), **get_command_metadata(CliCommand.PROJECT_MODEL_LS))
|
|
775
|
-
def list_inference_simulator_models(
|
|
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
|
-
),
|
|
790
|
-
row: int = typer.Option(
|
|
791
|
-
5,
|
|
792
|
-
'--row',
|
|
793
|
-
'-r',
|
|
794
|
-
help=__("Set number of rows displayed per page"),
|
|
795
|
-
is_eager=False,
|
|
796
|
-
),
|
|
797
|
-
page: int = typer.Option(
|
|
798
|
-
1,
|
|
799
|
-
'--page',
|
|
800
|
-
'-p',
|
|
801
|
-
help=__("Set starting page for displaying output"),
|
|
802
|
-
is_eager=False,
|
|
803
|
-
),
|
|
804
|
-
statuses: List[str] = typer.Option(
|
|
805
|
-
None,
|
|
806
|
-
'--status',
|
|
807
|
-
'-s',
|
|
808
|
-
help=__("Filter by status, use --status all to list all inference simulator models"),
|
|
809
|
-
is_eager=False,
|
|
810
|
-
),
|
|
811
|
-
):
|
|
812
|
-
command_name = CliCommand.PROJECT_MODEL_LS
|
|
813
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
814
|
-
check_command_permission(command_name)
|
|
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
|
-
|
|
820
|
-
service_factory = validate_config_and_get_service_factory()
|
|
821
|
-
project_service: ProjectService = service_factory.get_project_service()
|
|
822
|
-
|
|
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
|
-
)
|
|
830
|
-
|
|
831
|
-
typer.echo(__("Inference simulator models listing complete"))
|
|
832
|
-
raise typer.Exit(0)
|
|
833
|
-
|
|
834
|
-
|
|
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))
|
|
836
|
-
def inference_simulator_logs(
|
|
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
|
-
),
|
|
851
|
-
logs_number: Optional[int] = typer.Option(
|
|
852
|
-
None,
|
|
853
|
-
'--number',
|
|
854
|
-
'-n',
|
|
855
|
-
help=__("Display a number of latest log entries. No real-time stream if provided."),
|
|
856
|
-
is_eager=False,
|
|
857
|
-
),
|
|
858
|
-
):
|
|
859
|
-
command_name = CliCommand.PROJECT_INFERENCE_SIMULATOR_LOGS
|
|
860
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
861
|
-
check_command_permission(command_name)
|
|
862
|
-
|
|
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.")
|
|
865
|
-
raise typer.Exit(1)
|
|
866
|
-
|
|
867
|
-
service_factory = validate_config_and_get_service_factory()
|
|
868
|
-
logging_service: LoggingService = service_factory.get_logging_service()
|
|
869
|
-
|
|
870
|
-
if logs_number is None:
|
|
871
|
-
logging_service.stream_inference_simulator_logs_with_controls(
|
|
872
|
-
public_id=public_id,
|
|
873
|
-
slug=slug,
|
|
874
|
-
)
|
|
875
|
-
else:
|
|
876
|
-
get_inference_simulator_response: Optional[GetInferenceSimulatorResponse] = service_factory.get_thestage_api_client().get_inference_simulator(
|
|
877
|
-
public_id=public_id,
|
|
878
|
-
slug=slug,
|
|
879
|
-
)
|
|
880
|
-
if not get_inference_simulator_response:
|
|
881
|
-
typer.echo("Inference simulator with not found")
|
|
882
|
-
raise typer.Exit(1)
|
|
883
|
-
else:
|
|
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)
|
|
886
|
-
|
|
887
|
-
app_logger.info(f'Inference simulator logs - end')
|
|
888
|
-
raise typer.Exit(0)
|
|
889
|
-
|
|
890
|
-
|
|
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))
|
|
892
|
-
def deploy_inference_simulator_model_to_instance(
|
|
893
|
-
model_public_id: Optional[str] = typer.Option(
|
|
894
|
-
None,
|
|
895
|
-
'--model-id',
|
|
896
|
-
'-mid',
|
|
897
|
-
help="The inference simulator model ID",
|
|
898
|
-
is_eager=False,
|
|
899
|
-
),
|
|
900
|
-
model_slug: Optional[str] = typer.Option(
|
|
901
|
-
None,
|
|
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"),
|
|
933
|
-
is_eager=False,
|
|
934
|
-
),
|
|
935
|
-
working_directory: Optional[str] = typer.Option(
|
|
936
|
-
None,
|
|
937
|
-
"--working-directory",
|
|
938
|
-
"-wd",
|
|
939
|
-
help=__("Full path to working directory. By default, the current directory is used"),
|
|
940
|
-
show_default=False,
|
|
941
|
-
is_eager=False,
|
|
942
|
-
),
|
|
943
|
-
enable_log_stream: Optional[bool] = typer.Option(
|
|
944
|
-
True,
|
|
945
|
-
" /--no-logs",
|
|
946
|
-
" /-nl",
|
|
947
|
-
help=__("Disable real-time log streaming"),
|
|
948
|
-
is_eager=False,
|
|
949
|
-
),
|
|
950
|
-
):
|
|
951
|
-
command_name = CliCommand.PROJECT_MODEL_DEPLOY_INSTANCE
|
|
952
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
953
|
-
check_command_permission(command_name)
|
|
954
|
-
|
|
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.")
|
|
957
|
-
|
|
958
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
959
|
-
project_service = service_factory.get_project_service()
|
|
960
|
-
|
|
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,
|
|
968
|
-
)
|
|
969
|
-
|
|
970
|
-
if enable_log_stream:
|
|
971
|
-
logging_service: LoggingService = service_factory.get_logging_service()
|
|
972
|
-
|
|
973
|
-
logging_service.stream_inference_simulator_logs_with_controls(
|
|
974
|
-
public_id=inference_simulator_public_id
|
|
975
|
-
)
|
|
976
|
-
raise typer.Exit(0)
|
|
977
|
-
|
|
978
|
-
|
|
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))
|
|
980
|
-
def deploy_inference_simulator_model_to_sagemaker(
|
|
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
|
-
),
|
|
995
|
-
arn: Optional[str] = typer.Option(
|
|
996
|
-
None,
|
|
997
|
-
'--amazon-resource-name',
|
|
998
|
-
'-arn',
|
|
999
|
-
help=__("The Amazon Resource Name of the IAM Role to use, e.g., arn:aws:iam::{aws_account_id}:role/{role}"),
|
|
1000
|
-
is_eager=False,
|
|
1001
|
-
),
|
|
1002
|
-
working_directory: Optional[str] = typer.Option(
|
|
1003
|
-
None,
|
|
1004
|
-
"--working-directory",
|
|
1005
|
-
"-wd",
|
|
1006
|
-
help=__("Full path to working directory. By default, the current directory is used"),
|
|
1007
|
-
show_default=False,
|
|
1008
|
-
is_eager=False,
|
|
1009
|
-
),
|
|
1010
|
-
instance_type: Optional[str] = typer.Option(
|
|
1011
|
-
None,
|
|
1012
|
-
'--instance-type',
|
|
1013
|
-
'-it',
|
|
1014
|
-
help=__("Instance type on which the inference simulator model will be deployed"),
|
|
1015
|
-
is_eager=False,
|
|
1016
|
-
),
|
|
1017
|
-
initial_variant_weight: Optional[float] = typer.Option(
|
|
1018
|
-
None,
|
|
1019
|
-
"--initial-variant-weight",
|
|
1020
|
-
"-ivw",
|
|
1021
|
-
help=__("Initial Variant Weight. By default 1.0"),
|
|
1022
|
-
show_default=False,
|
|
1023
|
-
is_eager=False,
|
|
1024
|
-
),
|
|
1025
|
-
initial_instance_count: Optional[int] = typer.Option(
|
|
1026
|
-
None,
|
|
1027
|
-
"--initial-instance-count",
|
|
1028
|
-
"-iic",
|
|
1029
|
-
help=__("Initial Instance Count"),
|
|
1030
|
-
show_default=False,
|
|
1031
|
-
is_eager=False,
|
|
1032
|
-
),
|
|
1033
|
-
|
|
1034
|
-
):
|
|
1035
|
-
command_name = CliCommand.PROJECT_MODEL_DEPLOY_SAGEMAKER
|
|
1036
|
-
app_logger.info(f'Running {command_name} from {get_current_directory()}')
|
|
1037
|
-
check_command_permission(command_name)
|
|
1038
|
-
|
|
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):
|
|
1044
|
-
raise typer.BadParameter(__("Invalid UID format. The UID can only contain letters, numbers, and hyphens."))
|
|
1045
|
-
|
|
1046
|
-
service_factory = validate_config_and_get_service_factory(working_directory=working_directory)
|
|
1047
|
-
project_service = service_factory.get_project_service()
|
|
1048
|
-
|
|
1049
|
-
project_service.project_deploy_inference_simulator_model_to_sagemaker(
|
|
1050
|
-
model_public_id=model_public_id,
|
|
1051
|
-
model_slug=model_slug,
|
|
1052
|
-
arn=arn,
|
|
1053
|
-
instance_type=instance_type,
|
|
1054
|
-
initial_variant_weight=initial_variant_weight,
|
|
1055
|
-
initial_instance_count=initial_instance_count,
|
|
1056
|
-
)
|