thestage 0.6.7__py3-none-any.whl → 0.6.8__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_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 +27 -22
- thestage/{services/container → docker_container/business}/mapper/container_mapper.py +3 -3
- thestage/docker_container/communication/__init__.py +0 -0
- thestage/{controllers/container_controller.py → docker_container/communication/docker_command.py} +17 -23
- thestage/docker_container/communication/docker_container_api_client.py +99 -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 +4 -4
- thestage/{services/clients/thestage_api/dtos/docker_container_controller → docker_container/dto}/docker_container_list_response.py +3 -5
- thestage/docker_container/dto/enum/__init__.py +0 -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 +3 -3
- 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 +47 -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 +304 -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.6.8.dist-info}/METADATA +1 -1
- thestage-0.6.8.dist-info/RECORD +219 -0
- {thestage-0.6.7.dist-info → thestage-0.6.8.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.6.8.dist-info}/entry_points.txt +0 -0
- {thestage-0.6.7.dist-info → thestage-0.6.8.dist-info}/licenses/LICENSE.txt +0 -0
thestage/{controllers/container_controller.py → docker_container/communication/docker_command.py}
RENAMED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import re
|
|
3
1
|
from pathlib import Path
|
|
4
2
|
from typing import Optional, List
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
import typer
|
|
6
5
|
|
|
7
6
|
from thestage.cli_command import CliCommand
|
|
8
7
|
from thestage.cli_command_helper import get_command_metadata, check_command_permission
|
|
9
|
-
from thestage.color_scheme.color_scheme import ColorScheme
|
|
10
|
-
from thestage.services.clients.thestage_api.api_client import TheStageApiClient
|
|
11
|
-
from thestage.services.clients.thestage_api.dtos.enums.container_pending_action import DockerContainerAction
|
|
12
|
-
from thestage.services.clients.thestage_api.dtos.container_response import DockerContainerDto
|
|
13
|
-
from thestage.i18n.translation import __
|
|
14
|
-
from thestage.services.container.container_service import ContainerService
|
|
15
|
-
from thestage.helpers.logger.app_logger import app_logger
|
|
16
8
|
from thestage.controllers.utils_controller import validate_config_and_get_service_factory, get_current_directory
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
from thestage.
|
|
9
|
+
from thestage.docker_container.business.container_service import ContainerService
|
|
10
|
+
from thestage.docker_container.dto.container_response import DockerContainerDto
|
|
11
|
+
from thestage.docker_container.dto.enum.container_pending_action import DockerContainerAction
|
|
12
|
+
from thestage.helpers.logger.app_logger import app_logger
|
|
13
|
+
from thestage.i18n.translation import __
|
|
14
|
+
from thestage.logging.business.logging_service import LoggingService
|
|
21
15
|
|
|
22
16
|
app = typer.Typer(no_args_is_help=True, help=__("Manage containers"))
|
|
23
17
|
|
|
@@ -65,7 +59,7 @@ def list_containers(
|
|
|
65
59
|
check_command_permission(command_name)
|
|
66
60
|
|
|
67
61
|
if sum(v is not None for v in [project_public_id, project_slug]) > 1:
|
|
68
|
-
typer.echo("
|
|
62
|
+
typer.echo("Provide a single identifier for project - ID or name.")
|
|
69
63
|
raise typer.Exit(1)
|
|
70
64
|
|
|
71
65
|
service_factory = validate_config_and_get_service_factory()
|
|
@@ -104,7 +98,7 @@ def container_info(
|
|
|
104
98
|
check_command_permission(command_name)
|
|
105
99
|
|
|
106
100
|
if sum(v is not None for v in [container_public_id, container_slug]) != 1:
|
|
107
|
-
typer.echo("
|
|
101
|
+
typer.echo("Provide a single identifier for container - ID or name.")
|
|
108
102
|
raise typer.Exit(1)
|
|
109
103
|
|
|
110
104
|
service_factory = validate_config_and_get_service_factory()
|
|
@@ -194,7 +188,7 @@ def container_connect(
|
|
|
194
188
|
check_command_permission(command_name)
|
|
195
189
|
|
|
196
190
|
if sum(v is not None for v in [container_public_id, container_slug]) != 1:
|
|
197
|
-
typer.echo("
|
|
191
|
+
typer.echo("Provide a single identifier for container - ID or name.")
|
|
198
192
|
raise typer.Exit(1)
|
|
199
193
|
|
|
200
194
|
if private_ssh_key_path and not Path(private_ssh_key_path).is_file():
|
|
@@ -240,7 +234,7 @@ def upload_file(
|
|
|
240
234
|
username_param=username,
|
|
241
235
|
)
|
|
242
236
|
|
|
243
|
-
app_logger.info(f'
|
|
237
|
+
app_logger.info(f'File upload completed')
|
|
244
238
|
raise typer.Exit(0)
|
|
245
239
|
|
|
246
240
|
|
|
@@ -269,7 +263,7 @@ def download_file(
|
|
|
269
263
|
username_param=username,
|
|
270
264
|
)
|
|
271
265
|
|
|
272
|
-
app_logger.info(f'
|
|
266
|
+
app_logger.info(f'File download completed')
|
|
273
267
|
raise typer.Exit(0)
|
|
274
268
|
|
|
275
269
|
|
|
@@ -307,7 +301,7 @@ def start_container(
|
|
|
307
301
|
action=DockerContainerAction.START
|
|
308
302
|
)
|
|
309
303
|
|
|
310
|
-
app_logger.info(f'
|
|
304
|
+
app_logger.info(f'Container start completed')
|
|
311
305
|
raise typer.Exit(0)
|
|
312
306
|
|
|
313
307
|
|
|
@@ -345,7 +339,7 @@ def stop_container(
|
|
|
345
339
|
action=DockerContainerAction.STOP
|
|
346
340
|
)
|
|
347
341
|
|
|
348
|
-
app_logger.info(f'
|
|
342
|
+
app_logger.info(f'Container stop completed')
|
|
349
343
|
raise typer.Exit(0)
|
|
350
344
|
|
|
351
345
|
|
|
@@ -383,7 +377,7 @@ def restart_container(
|
|
|
383
377
|
action=DockerContainerAction.RESTART
|
|
384
378
|
)
|
|
385
379
|
|
|
386
|
-
app_logger.info(f'
|
|
380
|
+
app_logger.info(f'Container restart completed')
|
|
387
381
|
raise typer.Exit(0)
|
|
388
382
|
|
|
389
383
|
|
|
@@ -430,5 +424,5 @@ def container_logs(
|
|
|
430
424
|
else:
|
|
431
425
|
logging_service.print_last_container_logs(container_public_id=container_public_id, container_slug=container_slug, logs_number=logs_number)
|
|
432
426
|
|
|
433
|
-
app_logger.info(f'Container
|
|
427
|
+
app_logger.info(f'Container log streaming completed')
|
|
434
428
|
raise typer.Exit(0)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from typing import Optional, List, Dict
|
|
2
|
+
|
|
3
|
+
from thestage.config.business.config_provider import ConfigProvider
|
|
4
|
+
from thestage.global_dto.enums.order_direction_type import OrderDirectionType
|
|
5
|
+
from thestage.services.clients.thestage_api.core.api_client_core import TheStageApiClientCore
|
|
6
|
+
from thestage.services.clients.thestage_api.dtos.base_response import TheStageBaseResponse
|
|
7
|
+
from thestage.services.clients.thestage_api.dtos.entity_filter_request import EntityFilterRequest
|
|
8
|
+
from thestage.services.clients.thestage_api.dtos.paginated_entity_list import PaginatedEntityList
|
|
9
|
+
|
|
10
|
+
from thestage.docker_container.dto.container_action_request import DockerContainerActionRequest
|
|
11
|
+
from thestage.docker_container.dto.container_response import (
|
|
12
|
+
DockerContainerDto,
|
|
13
|
+
DockerContainerViewResponse,
|
|
14
|
+
ContainerBusinessStatusMapperResponse
|
|
15
|
+
)
|
|
16
|
+
from thestage.docker_container.dto.docker_container_list_request import DockerContainerListRequest
|
|
17
|
+
from thestage.docker_container.dto.docker_container_list_response import DockerContainerListResponse
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DockerContainerApiClient(TheStageApiClientCore):
|
|
21
|
+
def __init__(self, config_provider: ConfigProvider):
|
|
22
|
+
super().__init__(url=config_provider.get_config().main.thestage_api_url)
|
|
23
|
+
self.__config_provider = config_provider
|
|
24
|
+
|
|
25
|
+
def get_container_list(
|
|
26
|
+
self,
|
|
27
|
+
project_public_id: Optional[str] = None,
|
|
28
|
+
project_slug: Optional[str] = None,
|
|
29
|
+
statuses: List[str] = [],
|
|
30
|
+
page: int = 1,
|
|
31
|
+
limit: int = 10,
|
|
32
|
+
) -> PaginatedEntityList[DockerContainerDto]:
|
|
33
|
+
request = DockerContainerListRequest(
|
|
34
|
+
statuses=statuses,
|
|
35
|
+
projectPublicId=project_public_id,
|
|
36
|
+
projectSlug=project_slug,
|
|
37
|
+
entityFilterRequest=EntityFilterRequest(
|
|
38
|
+
orderByField="createdAt",
|
|
39
|
+
orderByDirection=OrderDirectionType.DESC,
|
|
40
|
+
page=page,
|
|
41
|
+
limit=limit,
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
response = self._request(
|
|
46
|
+
method='POST',
|
|
47
|
+
url='/user-api/v2/docker-container/list',
|
|
48
|
+
data=request.model_dump(),
|
|
49
|
+
token=self.__config_provider.get_config().main.thestage_auth_token
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
result = DockerContainerListResponse.model_validate(response) if response else None
|
|
53
|
+
# return result.paginatedList.entities, result.paginatedList.pagination_data.total_pages if result and result.is_success else None
|
|
54
|
+
return result.paginatedList if result and result.is_success else None
|
|
55
|
+
|
|
56
|
+
def get_container(
|
|
57
|
+
self,
|
|
58
|
+
container_slug: Optional[str] = None,
|
|
59
|
+
container_public_id: Optional[str] = None,
|
|
60
|
+
) -> Optional[DockerContainerDto]:
|
|
61
|
+
data = {
|
|
62
|
+
"dockerContainerPublicId": container_public_id,
|
|
63
|
+
"dockerContainerSlug": container_slug,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
response = self._request(
|
|
67
|
+
method='POST',
|
|
68
|
+
url='/user-api/v2/docker-container/view',
|
|
69
|
+
data=data,
|
|
70
|
+
token=self.__config_provider.get_config().main.thestage_auth_token,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return DockerContainerViewResponse.model_validate(response).docker_container if response else None
|
|
74
|
+
|
|
75
|
+
def container_action(
|
|
76
|
+
self,
|
|
77
|
+
request_param: DockerContainerActionRequest,
|
|
78
|
+
) -> TheStageBaseResponse:
|
|
79
|
+
|
|
80
|
+
response = self._request(
|
|
81
|
+
method='POST',
|
|
82
|
+
url='/user-api/v2/docker-container/action',
|
|
83
|
+
data=request_param.model_dump(by_alias=True),
|
|
84
|
+
token=self.__config_provider.get_config().main.thestage_auth_token,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
result = TheStageBaseResponse.model_validate(response) if response else None
|
|
88
|
+
return result
|
|
89
|
+
|
|
90
|
+
def get_container_business_status_map(self) -> Optional[Dict[str, str]]:
|
|
91
|
+
response = self._request(
|
|
92
|
+
method='POST',
|
|
93
|
+
url='/user-api/v1/docker-container/status-localized-mapping',
|
|
94
|
+
data=None,
|
|
95
|
+
token=self.__config_provider.get_config().main.thestage_auth_token,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
data = ContainerBusinessStatusMapperResponse.model_validate(response) if response else None
|
|
99
|
+
return data.docker_container_status_map if data else None
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, BaseModel, ConfigDict
|
|
4
|
+
|
|
5
|
+
from thestage.docker_container.dto.enum.container_pending_action import DockerContainerAction
|
|
6
|
+
|
|
7
|
+
class DockerContainerActionRequest(BaseModel):
|
|
8
|
+
model_config = ConfigDict(use_enum_values=True)
|
|
9
|
+
|
|
10
|
+
dockerContainerPublicId: Optional[str] = Field(None, alias='dockerContainerPublicId')
|
|
11
|
+
action: DockerContainerAction = Field(None, alias='action')
|
|
@@ -2,11 +2,11 @@ from typing import Optional, List, Dict
|
|
|
2
2
|
|
|
3
3
|
from pydantic import Field, BaseModel, ConfigDict
|
|
4
4
|
|
|
5
|
-
from thestage.
|
|
5
|
+
from thestage.docker_container.dto.docker_container_mapping import DockerContainerMappingDto
|
|
6
6
|
from thestage.services.clients.thestage_api.dtos.frontend_status import FrontendStatusDto
|
|
7
|
-
from thestage.
|
|
8
|
-
from thestage.
|
|
9
|
-
from thestage.
|
|
7
|
+
from thestage.instance.dto.instance_rented_response import InstanceRentedDto
|
|
8
|
+
from thestage.project.dto.project_response import ProjectDto
|
|
9
|
+
from thestage.instance.dto.selfhosted_instance_response import SelfHostedInstanceDto
|
|
10
10
|
from thestage.services.clients.thestage_api.dtos.base_response import TheStageBaseResponse, TheStageBasePaginatedResponse
|
|
11
11
|
from thestage.services.clients.thestage_api.dtos.pagination_data import PaginationData
|
|
12
12
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
from pydantic import Field, ConfigDict, BaseModel
|
|
1
|
+
from pydantic import Field, ConfigDict
|
|
4
2
|
|
|
5
3
|
from thestage.services.clients.thestage_api.dtos.base_response import TheStageBaseResponse
|
|
6
|
-
from thestage.
|
|
4
|
+
from thestage.docker_container.dto.container_response import DockerContainerDto
|
|
7
5
|
from thestage.services.clients.thestage_api.dtos.paginated_entity_list import PaginatedEntityList
|
|
8
|
-
|
|
6
|
+
|
|
9
7
|
|
|
10
8
|
class DockerContainerListResponse(TheStageBaseResponse):
|
|
11
9
|
model_config = ConfigDict(use_enum_values=True)
|
|
File without changes
|
thestage/git/__init__.py
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -12,9 +12,9 @@ from gitdb.exc import BadName
|
|
|
12
12
|
from rich import print
|
|
13
13
|
|
|
14
14
|
from thestage.color_scheme.color_scheme import ColorScheme
|
|
15
|
-
from thestage.config import THESTAGE_CONFIG_DIR
|
|
15
|
+
from thestage.config.env_base import THESTAGE_CONFIG_DIR
|
|
16
16
|
from thestage.exceptions.git_access_exception import GitAccessException
|
|
17
|
-
from thestage.git.ProgressPrinter import ProgressPrinter
|
|
17
|
+
from thestage.git.business.ProgressPrinter import ProgressPrinter
|
|
18
18
|
from thestage.services.filesystem_service import FileSystemService
|
|
19
19
|
|
|
20
20
|
|
|
@@ -33,7 +33,7 @@ class GitLocalClient:
|
|
|
33
33
|
):
|
|
34
34
|
self.__file_system_service = file_system_service
|
|
35
35
|
|
|
36
|
-
# todo delete this
|
|
36
|
+
# todo delete this
|
|
37
37
|
def __get_repo(self, path: str) -> Repo:
|
|
38
38
|
return git.Repo(path)
|
|
39
39
|
|
|
@@ -392,7 +392,7 @@ class GitLocalClient:
|
|
|
392
392
|
repo.git.reset('--hard', f'origin/{repo.active_branch.name}')
|
|
393
393
|
typer.echo(f'Branch "{repo.active_branch.name}" is now synced to its remote counterpart')
|
|
394
394
|
else:
|
|
395
|
-
typer.echo('
|
|
395
|
+
typer.echo('Simple branch reset is not implemented')
|
|
396
396
|
|
|
397
397
|
# refers to a "headless commit" where something was committed while in detached head state and head is pointing at that commit
|
|
398
398
|
def is_head_committed_in_headless_state(self, path: str) -> bool:
|
|
File without changes
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ from click.exceptions import Exit, Abort
|
|
|
7
7
|
from git import GitCommandError
|
|
8
8
|
from paramiko.ssh_exception import PasswordRequiredException
|
|
9
9
|
|
|
10
|
-
from thestage.config import THESTAGE_API_URL
|
|
10
|
+
from thestage.config.env_base import THESTAGE_API_URL
|
|
11
11
|
from thestage.exceptions.file_system_exception import FileSystemException
|
|
12
12
|
from thestage.exceptions.remote_server_exception import RemoteServerException
|
|
13
13
|
from thestage.i18n.translation import __
|
|
@@ -26,7 +26,7 @@ def error_handler() -> Callable:
|
|
|
26
26
|
result = f(*args, **kwargs)
|
|
27
27
|
return result
|
|
28
28
|
except AuthException as e1:
|
|
29
|
-
typer.echo(__('Authentication failed: update
|
|
29
|
+
typer.echo(__('Authentication failed: update access token'))
|
|
30
30
|
app_logger.error(f'{traceback.format_exc()}')
|
|
31
31
|
raise typer.Exit(1)
|
|
32
32
|
except BusinessLogicException as e2:
|
|
@@ -98,7 +98,7 @@ def error_handler() -> Callable:
|
|
|
98
98
|
raise typer.Exit(1)
|
|
99
99
|
except PasswordRequiredException as e11:
|
|
100
100
|
# technically we can use encrypted keys but dealing with passwords is big bs
|
|
101
|
-
typer.echo("Provided key requires password.
|
|
101
|
+
typer.echo("Provided key requires password. Use non-encrypted key.")
|
|
102
102
|
app_logger.error(f'{traceback.format_exc()}')
|
|
103
103
|
raise typer.Exit(1)
|
|
104
104
|
except Exception as e100:
|
|
@@ -3,10 +3,8 @@ import platform
|
|
|
3
3
|
from logging.handlers import RotatingFileHandler
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from thestage import __app_name__, __version__
|
|
6
|
+
from thestage.config.env_base import THESTAGE_CONFIG_DIR, THESTAGE_LOGGING_FILE
|
|
6
7
|
|
|
7
|
-
from thestage.config import THESTAGE_CONFIG_DIR
|
|
8
|
-
|
|
9
|
-
from thestage.config import THESTAGE_LOGGING_FILE
|
|
10
8
|
from thestage.exceptions.file_system_exception import FileSystemException
|
|
11
9
|
|
|
12
10
|
|
thestage/i18n/en_GB/messages.po
CHANGED
|
@@ -161,7 +161,7 @@ msgstr "Add URL to your own repository"
|
|
|
161
161
|
|
|
162
162
|
# Branch: feature/add_new_method_for_containers
|
|
163
163
|
#: tsr/controllers/sketch_controller.py
|
|
164
|
-
msgid "This folder is not empty, we
|
|
164
|
+
msgid "This folder is not empty, we cannot clone here"
|
|
165
165
|
msgstr "Cannot clone: the folder is not empty"
|
|
166
166
|
|
|
167
167
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -362,7 +362,7 @@ msgstr "Task title is required: please type or select to auto-generate"
|
|
|
362
362
|
|
|
363
363
|
# Branch: feature/add_new_method_for_containers
|
|
364
364
|
#: tsr/services/sketch/sketch_service.py
|
|
365
|
-
msgid "Task title
|
|
365
|
+
msgid "Task title cannot be empty"
|
|
366
366
|
msgstr "Task title is required"
|
|
367
367
|
|
|
368
368
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -427,7 +427,7 @@ msgstr "Incorrect slug specified: sketch not found"
|
|
|
427
427
|
|
|
428
428
|
# Branch: feature/add_new_method_for_containers
|
|
429
429
|
#: tsr/services/sketch/sketch_service.py
|
|
430
|
-
msgid "You have local repo with remote, we
|
|
430
|
+
msgid "You have local repo with remote, we cannot work with this"
|
|
431
431
|
msgstr "Your local repository is linked to a remote: this configuration is not supported for the current operation"
|
|
432
432
|
|
|
433
433
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -442,12 +442,12 @@ msgstr "Your local repo has been modified and is not empty, please create an emp
|
|
|
442
442
|
|
|
443
443
|
# Branch: feature/add_new_method_for_containers
|
|
444
444
|
#: tsr/services/sketch/sketch_service.py
|
|
445
|
-
msgid "We
|
|
445
|
+
msgid "We cannot add remote, something wrong"
|
|
446
446
|
msgstr "Cannot add remote, something wrong"
|
|
447
447
|
|
|
448
448
|
# Branch: feature/add_new_method_for_containers
|
|
449
449
|
#: tsr/services/sketch/sketch_service.py
|
|
450
|
-
msgid "You have local repo, we
|
|
450
|
+
msgid "You have local repo, we cannot work with this"
|
|
451
451
|
msgstr "Local repository in use: not supported for current operation"
|
|
452
452
|
|
|
453
453
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -517,12 +517,12 @@ msgstr "Path not found"
|
|
|
517
517
|
|
|
518
518
|
# Branch: feature/add_new_method_for_containers
|
|
519
519
|
#: tsr/services/filesystem_service.py
|
|
520
|
-
msgid "We
|
|
520
|
+
msgid "We cannot make dir"
|
|
521
521
|
msgstr "Failed to create directory"
|
|
522
522
|
|
|
523
523
|
# Branch: feature/add_new_method_for_containers
|
|
524
524
|
#: tsr/services/filesystem_service.py
|
|
525
|
-
msgid "We
|
|
525
|
+
msgid "We cannot make file"
|
|
526
526
|
msgstr "Failed to create file"
|
|
527
527
|
|
|
528
528
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -692,12 +692,12 @@ msgstr "Cannot connect to rented or self-hosted instance"
|
|
|
692
692
|
|
|
693
693
|
# Branch: feature/add_new_method_for_containers
|
|
694
694
|
#: tsr/services/container/container_service.py
|
|
695
|
-
msgid "Container name not present,
|
|
695
|
+
msgid "Container name not present, cannot connect to container"
|
|
696
696
|
msgstr "Cannot connect to container: please specify container slug"
|
|
697
697
|
|
|
698
698
|
# Branch: feature/add_new_method_for_containers
|
|
699
699
|
#: tsr/services/container/container_service.py
|
|
700
|
-
msgid "We
|
|
700
|
+
msgid "We cannot get shell on container (bash, shell), please use standard shell"
|
|
701
701
|
msgstr "Unable to access the requested shell (bash, shell) in the container: please use the default shell available in the container"
|
|
702
702
|
|
|
703
703
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -722,7 +722,7 @@ msgstr "Specify username to connect to server instance"
|
|
|
722
722
|
|
|
723
723
|
# Branch: feature/add_new_method_for_containers
|
|
724
724
|
#: tsr/services/container/container_service.py
|
|
725
|
-
msgid "Container is running,
|
|
725
|
+
msgid "Container is running, cannot start working server"
|
|
726
726
|
msgstr "Container is running: cannot start running container"
|
|
727
727
|
|
|
728
728
|
# Branch: feature/add_new_method_for_containers
|
|
@@ -797,7 +797,7 @@ msgstr "Server instance slug not found"
|
|
|
797
797
|
|
|
798
798
|
# Branch: feature/add_new_method_for_containers
|
|
799
799
|
#: tsr/services/sketch/sketch_service.py
|
|
800
|
-
msgid "Slug
|
|
800
|
+
msgid "Slug cannot be empty"
|
|
801
801
|
msgstr "Specify slug"
|
|
802
802
|
|
|
803
803
|
# Branch: main
|
|
@@ -928,17 +928,17 @@ msgstr ""
|
|
|
928
928
|
|
|
929
929
|
# Branch: main
|
|
930
930
|
#: tsr/services/container/container_service.py
|
|
931
|
-
msgid "Error,
|
|
931
|
+
msgid "Error, cannot find mapping folders"
|
|
932
932
|
msgstr ""
|
|
933
933
|
|
|
934
934
|
# Branch: main
|
|
935
935
|
#: tsr/services/container/container_service.py
|
|
936
|
-
msgid "Error,
|
|
936
|
+
msgid "Error, cannot find mapping for /public folder"
|
|
937
937
|
msgstr ""
|
|
938
938
|
|
|
939
939
|
# Branch: main
|
|
940
940
|
#: tsr/services/remote_server_service.py
|
|
941
|
-
msgid "
|
|
941
|
+
msgid "cannot find mapping folders"
|
|
942
942
|
msgstr ""
|
|
943
943
|
|
|
944
944
|
# Branch: main
|
|
File without changes
|
|
File without changes
|