thestage 0.5.46__tar.gz → 0.5.49__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. {thestage-0.5.46 → thestage-0.5.49}/LICENSE.txt +12 -12
  2. {thestage-0.5.46 → thestage-0.5.49}/PKG-INFO +3 -4
  3. {thestage-0.5.46 → thestage-0.5.49}/README.md +68 -68
  4. {thestage-0.5.46 → thestage-0.5.49}/pyproject.toml +50 -48
  5. {thestage-0.5.46 → thestage-0.5.49}/thestage/.env +5 -6
  6. {thestage-0.5.46 → thestage-0.5.49}/thestage/__init__.py +3 -3
  7. {thestage-0.5.46 → thestage-0.5.49}/thestage/__main__.py +9 -9
  8. thestage-0.5.49/thestage/cli_command.py +56 -0
  9. thestage-0.5.49/thestage/cli_command_helper.py +51 -0
  10. {thestage-0.5.46 → thestage-0.5.49}/thestage/color_scheme/color_scheme.py +7 -7
  11. {thestage-0.5.46 → thestage-0.5.49}/thestage/config/__init__.py +18 -18
  12. thestage-0.5.49/thestage/config/config_storage.py +5 -0
  13. {thestage-0.5.46 → thestage-0.5.49}/thestage/config/env_base.py +7 -7
  14. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/__init__.py +0 -0
  15. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/base_controller.py +67 -63
  16. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/config_controller.py +137 -145
  17. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/container_controller.py +389 -425
  18. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/instance_controller.py +183 -200
  19. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/project_controller.py +802 -872
  20. {thestage-0.5.46 → thestage-0.5.49}/thestage/controllers/utils_controller.py +32 -28
  21. {thestage-0.5.46 → thestage-0.5.49}/thestage/debug_main.dist.py +28 -28
  22. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/__init__.py +0 -0
  23. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/container.py +17 -22
  24. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/enums/__init__.py +0 -0
  25. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/enums/order_direction_type.py +6 -6
  26. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/enums/shell_type.py +7 -7
  27. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/enums/tail_output_type.py +6 -6
  28. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/enums/yes_no_response.py +7 -7
  29. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/file_item.py +27 -27
  30. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/project_inference_simulator.py +18 -18
  31. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/project_inference_simulator_model.py +16 -16
  32. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/project_task.py +19 -19
  33. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/rented_instance.py +19 -24
  34. {thestage-0.5.46 → thestage-0.5.49}/thestage/entities/self_hosted_instance.py +18 -20
  35. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/__init__.py +0 -0
  36. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/auth_exception.py +6 -6
  37. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/base_exception.py +13 -13
  38. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/business_logic_exception.py +6 -6
  39. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/config_exception.py +6 -6
  40. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/file_system_exception.py +6 -6
  41. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/git_access_exception.py +17 -17
  42. {thestage-0.5.46 → thestage-0.5.49}/thestage/exceptions/remote_server_exception.py +24 -24
  43. {thestage-0.5.46 → thestage-0.5.49}/thestage/git/ProgressPrinter.py +22 -22
  44. {thestage-0.5.46 → thestage-0.5.49}/thestage/helpers/__init__.py +0 -0
  45. {thestage-0.5.46 → thestage-0.5.49}/thestage/helpers/error_handler.py +115 -115
  46. thestage-0.5.49/thestage/helpers/exception_hook.py +14 -0
  47. {thestage-0.5.46 → thestage-0.5.49}/thestage/helpers/logger/__init__.py +0 -0
  48. {thestage-0.5.46 → thestage-0.5.49}/thestage/helpers/logger/app_logger.py +50 -51
  49. {thestage-0.5.46 → thestage-0.5.49}/thestage/helpers/ssh_util.py +38 -38
  50. {thestage-0.5.46 → thestage-0.5.49}/thestage/i18n/en_GB/messages.po +947 -947
  51. {thestage-0.5.46 → thestage-0.5.49}/thestage/i18n/translation.py +9 -9
  52. thestage-0.5.49/thestage/main.py +36 -0
  53. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/.env +6 -6
  54. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/__init__.py +0 -0
  55. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/abstract_mapper.py +9 -9
  56. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/abstract_service.py +87 -127
  57. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/app_config_service.py +52 -51
  58. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/__init__.py +0 -0
  59. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/git/__init__.py +0 -0
  60. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/git/git_client.py +433 -331
  61. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/__init__.py +0 -0
  62. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/api_client.py +718 -734
  63. thestage-0.5.46/thestage/services/clients/thestage_api/core/api_client_abstract.py → thestage-0.5.49/thestage/services/clients/thestage_api/core/api_client_core.py +108 -91
  64. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/core/http_client_exception.py +12 -12
  65. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/__init__.py +0 -0
  66. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/base_response.py +13 -13
  67. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/cloud_provider_region.py +19 -19
  68. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/container_param_request.py +11 -11
  69. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/container_response.py +67 -67
  70. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/docker_container_assigned_device.py +10 -10
  71. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/docker_container_controller/docker_container_list_request.py +13 -13
  72. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/docker_container_controller/docker_container_list_response.py +13 -13
  73. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/docker_container_mapping.py +10 -10
  74. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/entity_filter_request.py +14 -14
  75. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/__init__.py +0 -0
  76. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/container_pending_action.py +10 -10
  77. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/container_status.py +17 -17
  78. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/cpu_type.py +8 -8
  79. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/currency_type.py +10 -10
  80. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/daemon_status.py +9 -9
  81. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/disk_type.py +7 -7
  82. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/drive_type.py +7 -7
  83. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/gpu_name.py +8 -8
  84. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/inference_model_status.py +9 -9
  85. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/inference_simulator_status.py +15 -15
  86. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/instance_rented_status.py +17 -17
  87. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/instance_type.py +7 -7
  88. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/location_region.py +11 -11
  89. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/power_status.py +10 -10
  90. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/provider_name.py +11 -11
  91. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/selfhosted_status.py +10 -10
  92. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/task_execution_status.py +12 -12
  93. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/enums/task_status.py +12 -12
  94. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/frontend_status.py +10 -10
  95. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_request.py +13 -13
  96. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_instance_response.py +13 -13
  97. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_sagemaker_request.py +12 -12
  98. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/deploy_inference_model_to_sagemaker_response.py +12 -12
  99. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/get_inference_simulator_request.py +10 -10
  100. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/get_inference_simulator_response.py +13 -13
  101. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_list_for_project_request.py +14 -14
  102. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_list_for_project_response.py +12 -12
  103. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_model_list_for_project_request.py +12 -12
  104. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_controller/inference_simulator_model_list_for_project_response.py +13 -13
  105. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_simulator_model_response.py +11 -11
  106. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/inference_simulator_response.py +11 -11
  107. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/installed_service.py +17 -17
  108. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/instance_detected_gpus.py +20 -20
  109. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/instance_rented_response.py +71 -71
  110. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/logging_controller/docker_container_log_stream_request.py +7 -7
  111. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/logging_controller/log_polling_request.py +13 -13
  112. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/logging_controller/log_polling_response.py +14 -14
  113. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/logging_controller/task_log_stream_request.py +7 -7
  114. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/logging_controller/user_logs_query_request.py +21 -21
  115. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/logging_controller/user_logs_query_response.py +14 -14
  116. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/paginated_entity_list.py +11 -11
  117. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/pagination_data.py +10 -10
  118. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/price_definition.py +14 -14
  119. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_request.py +7 -7
  120. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_get_deploy_ssh_key_response.py +10 -10
  121. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_request.py +8 -8
  122. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_push_inference_simulator_model_response.py +6 -6
  123. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_request.py +15 -15
  124. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_response.py +10 -10
  125. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_request.py +13 -14
  126. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_response.py +10 -10
  127. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/project_response.py +32 -32
  128. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/selfhosted_instance_response.py +56 -56
  129. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/sftp_path_helper.py +13 -13
  130. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_key_to_user_request.py +8 -8
  131. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_key_to_user_response.py +11 -11
  132. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_public_key_to_instance_request.py +8 -8
  133. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_public_key_to_instance_response.py +11 -11
  134. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/is_user_has_public_ssh_key_request.py +7 -7
  135. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/ssh_key_controller/is_user_has_public_ssh_key_response.py +12 -12
  136. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/task_controller/task_list_for_project_request.py +10 -10
  137. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/task_controller/task_list_for_project_response.py +12 -12
  138. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/task_controller/task_status_localized_map_response.py +9 -9
  139. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/task_controller/task_view_response.py +12 -12
  140. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/clients/thestage_api/dtos/user_controller/user_profile.py +12 -12
  141. thestage-0.5.49/thestage/services/clients/thestage_api/dtos/validate_token_response.py +11 -0
  142. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/config_provider/__init__.py +0 -0
  143. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/config_provider/config_provider.py +237 -209
  144. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/connect/connect_service.py +196 -207
  145. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/connect/dto/remote_server_config.py +9 -9
  146. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/container/__init__.py +0 -0
  147. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/container/container_service.py +374 -391
  148. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/container/mapper/__init__.py +0 -0
  149. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/container/mapper/container_mapper.py +30 -30
  150. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/core_files/config_entity.py +26 -20
  151. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/filesystem_service.py +133 -133
  152. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/instance/__init__.py +0 -0
  153. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/instance/instance_service.py +303 -317
  154. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/instance/mapper/__init__.py +0 -0
  155. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/instance/mapper/instance_mapper.py +24 -24
  156. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/instance/mapper/selfhosted_mapper.py +33 -33
  157. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/logging/byte_print_style.py +5 -5
  158. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/logging/dto/log_message.py +15 -15
  159. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/logging/dto/log_type.py +6 -6
  160. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/logging/exception/log_polling_exception.py +6 -6
  161. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/logging/logging_constants.py +3 -3
  162. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/logging/logging_service.py +367 -395
  163. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/__init__.py +0 -0
  164. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/dto/inference_simulator_dto.py +22 -22
  165. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/dto/inference_simulator_model_dto.py +20 -20
  166. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/dto/project_config.py +14 -14
  167. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/mapper/__init__.py +0 -0
  168. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/mapper/project_inference_simulator_mapper.py +21 -21
  169. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/mapper/project_inference_simulator_model_mapper.py +21 -21
  170. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/mapper/project_task_mapper.py +22 -22
  171. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/project/project_service.py +1260 -1280
  172. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/remote_server_service.py +609 -610
  173. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/service_factory.py +97 -103
  174. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/task/dto/task_dto.py +40 -40
  175. {thestage-0.5.46 → thestage-0.5.49}/thestage/services/validation_service.py +61 -56
  176. thestage-0.5.46/thestage/exceptions/http_error_exception.py +0 -12
  177. thestage-0.5.46/thestage/main.py +0 -24
  178. thestage-0.5.46/thestage/services/clients/thestage_api/core/api_client_core.py +0 -25
@@ -1,13 +1,13 @@
1
- Copyright 2024 TheStage AI. All rights reserved.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright 2024 TheStage AI. All rights reserved.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.1
2
2
  Name: thestage
3
- Version: 0.5.46
3
+ Version: 0.5.49
4
4
  Summary:
5
5
  Author: TheStage AI team
6
6
  Author-email: hello@thestage.ai
@@ -10,12 +10,11 @@ Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
13
  Requires-Dist: aioconsole (>=0.8.0,<0.9.0)
15
14
  Requires-Dist: boto3 (>=1.35.80,<2.0.0)
16
15
  Requires-Dist: gitpython (>=3.1.40,<4.0.0)
17
16
  Requires-Dist: httpx (>=0.27.2,<0.28.0)
18
- Requires-Dist: paramiko (>=3.4.0,<4.0.0)
17
+ Requires-Dist: paramiko (>=3.5.1,<4.0.0)
19
18
  Requires-Dist: pydantic (>=2.4.2,<3.0.0)
20
19
  Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
21
20
  Requires-Dist: python-gettext-translations (>=1.1.0,<2.0.0)
@@ -1,69 +1,69 @@
1
- # Introduction
2
-
3
- [TheStage AI](https://app.thestage.ai/) is an integrated platform designed for AI researchers, focusing on solving challenges related to accelerating deep neural network (DNN) inference.
4
-
5
- **TheStage CLI** provides a command-line interface for interacting with TheStage AI infrastructure, allowing researchers to:
6
-
7
- - **Server Instances:** Retrieve information and connect to instances.
8
- - **Docker Containers:** Manage containers by retrieving information, connecting, streaming real-time logs, uploading/downloading files, and starting/stopping containers.
9
- - **Projects:** Clone and initialize projects, retrieve project specific task information, run tasks within a project, and stream real-time task logs.
10
-
11
- TheStage AI's web-based interface provides full control over managing resources such as creating, renting, deleting components, etc..
12
-
13
- # Requirements
14
-
15
- TheStage CLI is developed using Python and Poetry. Supported versions are Python 3.9 to 3.12 and Poetry 1.7.1. While the CLI is compatible with various operating systems, we recommend using a Unix-like OS such as Linux or macOS for optimal performance.
16
-
17
- **Additional Software Requirements:**
18
-
19
- - Git
20
- - Python 3.9 to 3.12
21
- - SSH client
22
-
23
- These tools must be installed for the CLI to function correctly.
24
-
25
- # Authentication and Authorization
26
-
27
- To securely connect to TheStage AI's backend and access information about server instances, containers, and more, API tokens are required. These tokens serve as both authentication and authorization mechanisms and can be generated through TheStage AI's web application.
28
-
29
- **Note:** An account on TheStage AI is required to generate an API token. Please refer to TheStage AI documentation: TheStage AI Platform: [SSH Keys and API Tokens](https://docs.thestage.ai/platform/build/thestage-ai-ssh-keys-and-api-tokens.html) for more information.
30
-
31
- # Installation and Initialization
32
-
33
- To generate an API token, please login to your [TheStage AI account](https://app.thestage.ai/sign-in), and navigate to the Profile > API tokens section. Please refer to [TheStage AI platform documentation](https://docs.thestage.ai/platform/build/thestage-ai-ssh-keys-and-api-tokens.html) for more information.
34
-
35
- ```python
36
- # To install TheStage CLI:
37
- pip install thestage
38
-
39
- # To upgrade thestage CLI:
40
- pip install thestage --upgrade
41
-
42
- # To set or change an API token:
43
- thestage config set --api-token <API_token>
44
-
45
- # To get help:
46
- thestage --help
47
- ```
48
-
49
- # Using the CLI
50
-
51
- ## **Unique IDs**
52
-
53
- When working with components of your computational cluster—such as server instances, Docker containers, and projects—the CLI often requires you to specify the unique ID of the component. This unique ID is assigned when the component is created in TheStage AI web application and can be found in your TheStage AI account or by listing the components using the CLI.
54
-
55
- ## **Connecting to server instances and containers**
56
-
57
- When connecting to a **rented server instance** or a Docker container hosted on it, the CLI uses the SSH key assigned to that server instance, which is stored in TheStage AI platform. If the instance status is "online" but the connection cannot be established, verify that an SSH key is associated with the server instance. For more information, see [your TheStage AI account > Profile > SSH Keys](https://app.thestage.ai/profile/ssh).
58
-
59
- When connecting to a **self-hosted instance** or a Docker container running on it, the CLI requires the username to be specified because it does not have information on which user to use. Ensure that the specified user has SSH access to the server. The instance status must be "online" for a successful connection. For more information, see [TheStage AI Platform: Self-hosted Instances](https://docs.thestage.ai/platform/build/thestage-ai-self-hosted-instances.html).
60
-
61
- # Additional Resources
62
-
63
- For comprehensive documentation on TheStage AI platform, please visit [TheStage AI Platform Documentation](https://docs.thestage.ai/platform/build/README.html).
64
-
65
- For more in-depth information on using TheStage CLI, including command references, please refer to [TheStage AI Platform: CLI](https://docs.thestage.ai/platform/build/thestage-ai-cli.html).
66
-
67
- # License
68
-
1
+ # Introduction
2
+
3
+ [TheStage AI](https://app.thestage.ai/) is an integrated platform designed for AI researchers, focusing on solving challenges related to accelerating deep neural network (DNN) inference.
4
+
5
+ **TheStage CLI** provides a command-line interface for interacting with TheStage AI infrastructure, allowing researchers to:
6
+
7
+ - **Server Instances:** Retrieve information and connect to instances.
8
+ - **Docker Containers:** Manage containers by retrieving information, connecting, streaming real-time logs, uploading/downloading files, and starting/stopping containers.
9
+ - **Projects:** Clone and initialize projects, retrieve project specific task information, run tasks within a project, and stream real-time task logs.
10
+
11
+ TheStage AI's web-based interface provides full control over managing resources such as creating, renting, deleting components, etc..
12
+
13
+ # Requirements
14
+
15
+ TheStage CLI is developed using Python and Poetry. Supported versions are Python 3.9 to 3.12 and Poetry 1.7.1. While the CLI is compatible with various operating systems, we recommend using a Unix-like OS such as Linux or macOS for optimal performance.
16
+
17
+ **Additional Software Requirements:**
18
+
19
+ - Git
20
+ - Python 3.9 to 3.12
21
+ - SSH client
22
+
23
+ These tools must be installed for the CLI to function correctly.
24
+
25
+ # Authentication and Authorization
26
+
27
+ To securely connect to TheStage AI's backend and access information about server instances, containers, and more, API tokens are required. These tokens serve as both authentication and authorization mechanisms and can be generated through TheStage AI's web application.
28
+
29
+ **Note:** An account on TheStage AI is required to generate an API token. Please refer to TheStage AI documentation: TheStage AI Platform: [SSH Keys and API Tokens](https://docs.thestage.ai/platform/build/thestage-ai-ssh-keys-and-api-tokens.html) for more information.
30
+
31
+ # Installation and Initialization
32
+
33
+ To generate an API token, please login to your [TheStage AI account](https://app.thestage.ai/sign-in), and navigate to the Profile > API tokens section. Please refer to [TheStage AI platform documentation](https://docs.thestage.ai/platform/build/thestage-ai-ssh-keys-and-api-tokens.html) for more information.
34
+
35
+ ```python
36
+ # To install TheStage CLI:
37
+ pip install thestage
38
+
39
+ # To upgrade thestage CLI:
40
+ pip install thestage --upgrade
41
+
42
+ # To set or change an API token:
43
+ thestage config set --api-token <API_token>
44
+
45
+ # To get help:
46
+ thestage --help
47
+ ```
48
+
49
+ # Using the CLI
50
+
51
+ ## **Unique IDs**
52
+
53
+ When working with components of your computational cluster—such as server instances, Docker containers, and projects—the CLI often requires you to specify the unique ID of the component. This unique ID is assigned when the component is created in TheStage AI web application and can be found in your TheStage AI account or by listing the components using the CLI.
54
+
55
+ ## **Connecting to server instances and containers**
56
+
57
+ When connecting to a **rented server instance** or a Docker container hosted on it, the CLI uses the SSH key assigned to that server instance, which is stored in TheStage AI platform. If the instance status is "online" but the connection cannot be established, verify that an SSH key is associated with the server instance. For more information, see [your TheStage AI account > Profile > SSH Keys](https://app.thestage.ai/profile/ssh).
58
+
59
+ When connecting to a **self-hosted instance** or a Docker container running on it, the CLI requires the username to be specified because it does not have information on which user to use. Ensure that the specified user has SSH access to the server. The instance status must be "online" for a successful connection. For more information, see [TheStage AI Platform: Self-hosted Instances](https://docs.thestage.ai/platform/build/thestage-ai-self-hosted-instances.html).
60
+
61
+ # Additional Resources
62
+
63
+ For comprehensive documentation on TheStage AI platform, please visit [TheStage AI Platform Documentation](https://docs.thestage.ai/platform/build/README.html).
64
+
65
+ For more in-depth information on using TheStage CLI, including command references, please refer to [TheStage AI Platform: CLI](https://docs.thestage.ai/platform/build/thestage-ai-cli.html).
66
+
67
+ # License
68
+
69
69
  TheStage CLI is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) (the "License"). You may not use TheStage CLI except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is provided on an "as-is" basis, without warranties or conditions of any kind, either express or implied.
@@ -1,48 +1,50 @@
1
- [tool.poetry]
2
- name = "thestage"
3
- version = "0.5.46"
4
- description = ""
5
- authors = ["TheStage AI team <hello@thestage.ai>"]
6
- readme = "README.md"
7
- packages = [
8
- { include = "thestage" },
9
- { include = "thestage/.env" },
10
- ]
11
-
12
- include = [
13
- { path = "thestage/.env" },
14
- ]
15
-
16
- exclude = [
17
- "thestage/.env_example",
18
- "thestage/debug_main.py"
19
- ]
20
-
21
- [tool.poetry.dependencies]
22
- python = ">=3.9,<=3.13"
23
- typer = {extras = ["all"], version = "^0.15.2"}
24
- tabulate = "^0.9.0"
25
- python-dotenv = "^1.0.0"
26
- pydantic = "^2.4.2"
27
- gitpython = "^3.1.40"
28
- requests = "^2.31.0"
29
- python-gettext-translations = "^1.1.0"
30
- paramiko = "^3.4.0"
31
-
32
- aioconsole = "^0.8.0"
33
- httpx = "^0.27.2"
34
- boto3 = "^1.35.80"
35
-
36
- [tool.poetry.dev-dependencies]
37
- pytest = "^7.4.3"
38
-
39
- [build-system]
40
- requires = ["poetry-core"]
41
- build-backend = "poetry.core.masonry.api"
42
-
43
- [tool.poetry.scripts]
44
- thestage = "thestage.main:main"
45
-
46
- [[tool.poetry.source]]
47
- name = "pypi"
48
- priority = "primary"
1
+ [tool.poetry]
2
+ name = "thestage"
3
+
4
+ version = "0.5.49"
5
+
6
+ description = ""
7
+ authors = ["TheStage AI team <hello@thestage.ai>"]
8
+ readme = "README.md"
9
+ packages = [
10
+ { include = "thestage" },
11
+ { include = "thestage/.env" },
12
+ ]
13
+
14
+ include = [
15
+ { path = "thestage/.env" },
16
+ ]
17
+
18
+ exclude = [
19
+ "thestage/.env_example",
20
+ "thestage/debug_main.py"
21
+ ]
22
+
23
+ [tool.poetry.dependencies]
24
+ python = ">=3.9,<=3.13"
25
+ typer = {extras = ["all"], version = "^0.15.2"}
26
+ tabulate = "^0.9.0"
27
+ python-dotenv = "^1.0.0"
28
+ pydantic = "^2.4.2"
29
+ gitpython = "^3.1.40"
30
+ requests = "^2.31.0"
31
+ python-gettext-translations = "^1.1.0"
32
+ paramiko = "^3.5.1"
33
+
34
+ aioconsole = "^0.8.0"
35
+ httpx = "^0.27.2"
36
+ boto3 = "^1.35.80"
37
+
38
+ [tool.poetry.dev-dependencies]
39
+ pytest = "^7.4.3"
40
+
41
+ [build-system]
42
+ requires = ["poetry-core"]
43
+ build-backend = "poetry.core.masonry.api"
44
+
45
+ [tool.poetry.scripts]
46
+ thestage = "thestage.main:main"
47
+
48
+ [[tool.poetry.source]]
49
+ name = "pypi"
50
+ priority = "primary"
@@ -1,6 +1,5 @@
1
- THESTAGE_CONFIG_DIR=.thestage
2
- THESTAGE_CONFIG_FILE=config.json
3
- THESTAGE_CLI_ENV=DEV
4
- THESTAGE_API_URL=https://backend-staging.thestage.ai
5
- THESTAGE_API_URL=https://backend.thestage.ai
6
- LOG_FILE=thestage.log
1
+ THESTAGE_CONFIG_DIR=.thestage
2
+ THESTAGE_CONFIG_FILE=config.json
3
+ THESTAGE_API_URL=https://backend-staging.thestage.ai
4
+ THESTAGE_API_URL=https://backend.thestage.ai
5
+ LOG_FILE=thestage.log
@@ -1,3 +1,3 @@
1
- from . import *
2
- __app_name__ = "thestage"
3
- __version__ = "0.5.46"
1
+ from . import *
2
+ __app_name__ = "thestage"
3
+ __version__ = "0.5.49"
@@ -1,9 +1,9 @@
1
- import thestage.main as main
2
-
3
-
4
- def start():
5
- main.main()
6
-
7
-
8
- if __name__ == "__main__":
9
- start()
1
+ import thestage.main as main
2
+
3
+
4
+ def start():
5
+ main.main()
6
+
7
+
8
+ if __name__ == "__main__":
9
+ start()
@@ -0,0 +1,56 @@
1
+ from enum import Enum
2
+
3
+ class CliCommand(str, Enum):
4
+ VERSION = "VERSION"
5
+ CONNECT = "CONNECT"
6
+ PROJECT_CLONE = "PROJECT_CLONE"
7
+ PROJECT_INIT = "PROJECT_INIT"
8
+ PROJECT_RUN = "PROJECT_RUN"
9
+ PROJECT_CHECKOUT = "PROJECT_CHECKOUT"
10
+ PROJECT_PULL = "PROJECT_PULL"
11
+ PROJECT_RESET = "PROJECT_RESET"
12
+ PROJECT_INFERENCE_SIMULATOR_RUN = "PROJECT_INFERENCE_SIMULATOR_RUN"
13
+ PROJECT_INFERENCE_SIMULATOR_SAVE_METADATA = "PROJECT_INFERENCE_SIMULATOR_SAVE_METADATA"
14
+ PROJECT_INFERENCE_SIMULATOR_PUSH = "PROJECT_INFERENCE_SIMULATOR_PUSH"
15
+ PROJECT_INFERENCE_SIMULATOR_LS = "PROJECT_INFERENCE_SIMULATOR_LS"
16
+ PROJECT_INFERENCE_SIMULATOR_LOGS = "PROJECT_INFERENCE_SIMULATOR_LOGS"
17
+ PROJECT_MODEL_LS = "PROJECT_MODEL_LS"
18
+ PROJECT_MODEL_DEPLOY_INSTANCE = "PROJECT_MODEL_DEPLOY_INSTANCE"
19
+ PROJECT_MODEL_DEPLOY_SAGEMAKER = "PROJECT_MODEL_DEPLOY_SAGEMAKER"
20
+ PROJECT_TASK_CANCEL = "PROJECT_TASK_CANCEL"
21
+ PROJECT_TASK_LS = "PROJECT_TASK_LS"
22
+ PROJECT_TASK_LOGS = "PROJECT_TASK_LOGS"
23
+ PROJECT_CONFIG_SET_DEFAULT_CONTAINER = "PROJECT_CONFIG_SET_DEFAULT_CONTAINER"
24
+ PROJECT_CONFIG_GET = "PROJECT_CONFIG_GET"
25
+ CONTAINER_LS = "CONTAINER_LS"
26
+ CONTAINER_INFO = "CONTAINER_INFO"
27
+ CONTAINER_CONNECT = "CONTAINER_CONNECT"
28
+ CONTAINER_UPLOAD = "CONTAINER_UPLOAD"
29
+ CONTAINER_DOWNLOAD = "CONTAINER_DOWNLOAD"
30
+ CONTAINER_START = "CONTAINER_START"
31
+ CONTAINER_STOP = "CONTAINER_STOP"
32
+ CONTAINER_RESTART = "CONTAINER_RESTART"
33
+ CONTAINER_LOGS = "CONTAINER_LOGS"
34
+ INSTANCE_RENTED_LS = "INSTANCE_RENTED_LS"
35
+ INSTANCE_RENTED_CONNECT = "INSTANCE_RENTED_CONNECT"
36
+ INSTANCE_SELF_HOSTED_LS = "INSTANCE_SELF_HOSTED_LS"
37
+ INSTANCE_SELF_HOSTED_CONNECT = "INSTANCE_SELF_HOSTED_CONNECT"
38
+ CONFIG_GET = "CONFIG_GET"
39
+ CONFIG_SET = "CONFIG_SET"
40
+ CONFIG_CLEAR = "CONFIG_CLEAR"
41
+ CONFIG_UPLOAD_SSH_KEY = "CONFIG_UPLOAD_SSH_KEY"
42
+
43
+
44
+ class CliCommandAvailability(str, Enum):
45
+ ALLOWED = "ALLOWED"
46
+ RESTRICTED = "RESTRICTED"
47
+ DEPRECATED = "DEPRECATED"
48
+
49
+
50
+ ALWAYS_AVAILABLE_COMMANDS = [
51
+ CliCommand.VERSION,
52
+ CliCommand.PROJECT_CONFIG_GET,
53
+ CliCommand.CONFIG_GET,
54
+ CliCommand.CONFIG_SET,
55
+ CliCommand.CONFIG_CLEAR,
56
+ ]
@@ -0,0 +1,51 @@
1
+ from typing import Callable
2
+
3
+ import typer
4
+
5
+ from thestage.cli_command import CliCommand, CliCommandAvailability
6
+ from thestage.color_scheme.color_scheme import ColorScheme
7
+ from thestage.config import config_storage
8
+ from rich import print
9
+
10
+
11
+ def cli_command(command_id: CliCommand):
12
+ def decorator(func: Callable):
13
+ setattr(func, "__cli_command__", command_id)
14
+ return func
15
+ return decorator
16
+
17
+
18
+ def get_command_metadata(command_id: CliCommand) -> dict:
19
+ return {
20
+ "rich_help_panel": get_command_help_panel(command_id),
21
+ "deprecated": is_command_deprecated(command_id),
22
+ }
23
+
24
+
25
+ def get_command_group_help_panel() -> str:
26
+ return "Command Groups"
27
+
28
+
29
+ def get_command_help_panel(command: CliCommand) -> str:
30
+ if config_storage.APP_CONFIG.runtime.allowed_commands.get(command) == CliCommandAvailability.ALLOWED:
31
+ return "Allowed Commands"
32
+ if config_storage.APP_CONFIG.runtime.allowed_commands.get(command) == CliCommandAvailability.RESTRICTED:
33
+ return "Restricted Commands"
34
+ if config_storage.APP_CONFIG.runtime.allowed_commands.get(command) == CliCommandAvailability.DEPRECATED:
35
+ return "Deprecated Commands"
36
+
37
+
38
+ def is_command_deprecated(command: CliCommand) -> bool:
39
+ if config_storage.APP_CONFIG.runtime.allowed_commands.get(command) == CliCommandAvailability.DEPRECATED:
40
+ return True
41
+ return False
42
+
43
+
44
+ def check_command_permission(executed_command: CliCommand):
45
+ if config_storage.APP_CONFIG.runtime.is_token_valid == False and executed_command != CliCommand.CONFIG_SET:
46
+ print(f"[{ColorScheme.WARNING.value}]Your API Token is not valid. You can update the token using 'thestage config set' command[{ColorScheme.WARNING.value}]")
47
+
48
+ is_allowed = config_storage.APP_CONFIG.runtime.allowed_commands.get(executed_command) == CliCommandAvailability.ALLOWED
49
+ if not is_allowed:
50
+ typer.echo("Action is not allowed")
51
+ raise typer.Exit(code=1)
@@ -1,7 +1,7 @@
1
- from enum import Enum
2
-
3
- # https://rich.readthedocs.io/en/stable/appendix/colors.html
4
- class ColorScheme(str, Enum):
5
- GIT_HEADLESS = "orange_red1"
6
- WARNING = "orange_red1"
7
- USEFUL_INFO = "deep_sky_blue1"
1
+ from enum import Enum
2
+
3
+ # https://rich.readthedocs.io/en/stable/appendix/colors.html
4
+ class ColorScheme(str, Enum):
5
+ GIT_HEADLESS = "orange_red1"
6
+ WARNING = "orange_red1"
7
+ USEFUL_INFO = "deep_sky_blue1"
@@ -1,18 +1,18 @@
1
- # Init project settings by ENV environment variable
2
- import locale
3
- from pathlib import Path
4
-
5
-
6
- from python_gettext_translations.translations import init_translations
7
-
8
- from thestage.config.env_base import *
9
-
10
-
11
- THESTAGE_LOCAL_LANGUAGE = 'en_GB'
12
- if locale.getlocale():
13
- THESTAGE_LOCAL_LANGUAGE = locale.getlocale()[0]
14
-
15
- translation = Path(f'i18n/')
16
-
17
- if translation.exists() and translation.is_dir():
18
- init_translations(f'i18n/')
1
+ # Init project settings by ENV environment variable
2
+ import locale
3
+ from pathlib import Path
4
+
5
+
6
+ from python_gettext_translations.translations import init_translations
7
+
8
+ from thestage.config.env_base import *
9
+
10
+
11
+ THESTAGE_LOCAL_LANGUAGE = 'en_GB'
12
+ if locale.getlocale():
13
+ THESTAGE_LOCAL_LANGUAGE = locale.getlocale()[0]
14
+
15
+ translation = Path(f'i18n/')
16
+
17
+ if translation.exists() and translation.is_dir():
18
+ init_translations(f'i18n/')
@@ -0,0 +1,5 @@
1
+ from typing import Optional
2
+
3
+ from thestage.services.core_files.config_entity import ConfigEntity
4
+
5
+ APP_CONFIG: Optional[ConfigEntity] = None
@@ -1,7 +1,7 @@
1
- import os
2
-
3
- THESTAGE_CONFIG_DIR = os.getenv('THESTAGE_CONFIG_DIR', '.thestage')
4
- THESTAGE_CONFIG_FILE = os.getenv('THESTAGE_CONFIG_FILE', 'config.json')
5
- THESTAGE_AUTH_TOKEN = os.getenv('THESTAGE_AUTH_TOKEN', None)
6
- THESTAGE_LOGGING_FILE = os.getenv('THESTAGE_LOGGING_FILE', 'thestage.log')
7
- THESTAGE_API_URL = os.getenv('THESTAGE_API_URL', 'https://backend.thestage.ai')
1
+ import os
2
+
3
+ THESTAGE_CONFIG_DIR = os.getenv('THESTAGE_CONFIG_DIR', '.thestage')
4
+ THESTAGE_CONFIG_FILE = os.getenv('THESTAGE_CONFIG_FILE', 'config.json')
5
+ THESTAGE_AUTH_TOKEN = os.getenv('THESTAGE_AUTH_TOKEN', None)
6
+ THESTAGE_LOGGING_FILE = os.getenv('THESTAGE_LOGGING_FILE', 'thestage.log')
7
+ THESTAGE_API_URL = os.getenv('THESTAGE_API_URL', 'https://backend.thestage.ai')
@@ -1,63 +1,67 @@
1
- from pathlib import Path
2
- from typing import Optional
3
-
4
- from thestage.i18n.translation import __
5
- from thestage.helpers.logger.app_logger import app_logger
6
- from thestage.controllers.utils_controller import get_current_directory, validate_config_and_get_service_factory
7
- from thestage import __app_name__, __version__
8
-
9
- import typer
10
-
11
- from thestage.services.connect.connect_service import ConnectService
12
-
13
- app = typer.Typer(no_args_is_help=True)
14
-
15
-
16
- @app.command(no_args_is_help=False)
17
- def version():
18
- """
19
- Returns the application's name and version
20
- """
21
- app_logger.info(f'Start version from {get_current_directory()}')
22
- typer.echo(
23
- __("%app_name% v%version%", {'app_name': __app_name__, 'version': __version__}))
24
- raise typer.Exit(0)
25
-
26
-
27
- @app.command(name="connect", no_args_is_help=True, help=__("Connect to server instance or container using unique ID"))
28
- def connect(
29
- uid: Optional[str] = typer.Argument(
30
- help=__("Unique ID of server instance or container"), ),
31
- username: Optional[str] = typer.Option(
32
- None,
33
- '--username',
34
- '-u',
35
- help=__("Username for the server instance (required when connecting to self-hosted instance)"),
36
- is_eager=False,
37
- ),
38
- private_ssh_key_path: str = typer.Option(
39
- None,
40
- "--private-key-path",
41
- "-pk",
42
- help=__("Path to private key that will be accepted by remote server (optional)"),
43
- is_eager=False,
44
- ),
45
- ):
46
- """
47
- Connects to entity with a unique ID
48
- """
49
- app_logger.info(f'Connect to some entity with UID')
50
-
51
- if private_ssh_key_path and not Path(private_ssh_key_path).is_file():
52
- typer.echo(f'No file found at provided path {private_ssh_key_path}')
53
- raise typer.Exit(1)
54
-
55
- service_factory = validate_config_and_get_service_factory()
56
-
57
- connect_service: ConnectService = service_factory.get_connect_service()
58
-
59
- connect_service.connect_to_entity(uid=uid, username=username, private_key_path=private_ssh_key_path)
60
-
61
-
62
- app_logger.info(f'Stop connect to entity')
63
- raise typer.Exit(0)
1
+ from pathlib import Path
2
+ from typing import Optional
3
+
4
+ from thestage.cli_command import CliCommand
5
+ from thestage.cli_command_helper import get_command_metadata, check_command_permission
6
+ from thestage.i18n.translation import __
7
+ from thestage.helpers.logger.app_logger import app_logger
8
+ from thestage.controllers.utils_controller import get_current_directory, validate_config_and_get_service_factory
9
+ from thestage import __app_name__, __version__
10
+
11
+ import typer
12
+
13
+ from thestage.services.connect.connect_service import ConnectService
14
+
15
+ app = typer.Typer(no_args_is_help=True,)
16
+
17
+
18
+ @app.command(name='version', help="Get application's name and version", no_args_is_help=False, **get_command_metadata(CliCommand.VERSION))
19
+ def version():
20
+ command_name = CliCommand.VERSION
21
+ app_logger.info(f'Running {command_name} from {get_current_directory()}')
22
+ check_command_permission(command_name)
23
+
24
+ typer.echo(f"{__app_name__} v{__version__}")
25
+ raise typer.Exit(0)
26
+
27
+
28
+ @app.command(name="connect", no_args_is_help=True, help=__("Connect to server instance or container or task"), **get_command_metadata(CliCommand.CONNECT))
29
+ def connect(
30
+ uid: Optional[str] = typer.Argument(
31
+ help=__("Unique ID of server instance or container or task ID"), ),
32
+ username: Optional[str] = typer.Option(
33
+ None,
34
+ '--username',
35
+ '-u',
36
+ help=__("Username for the server instance (required when connecting to self-hosted instance)"),
37
+ is_eager=False,
38
+ ),
39
+ private_ssh_key_path: str = typer.Option(
40
+ None,
41
+ "--private-key-path",
42
+ "-pk",
43
+ help=__("Path to private key that will be accepted by remote server (optional)"),
44
+ is_eager=False,
45
+ ),
46
+ ):
47
+ command_name = CliCommand.CONNECT
48
+ app_logger.info(f'Running {command_name} from {get_current_directory()}')
49
+ check_command_permission(command_name)
50
+
51
+ if private_ssh_key_path and not Path(private_ssh_key_path).is_file():
52
+ typer.echo(f'No file found at provided path {private_ssh_key_path}')
53
+ raise typer.Exit(1)
54
+
55
+ service_factory = validate_config_and_get_service_factory()
56
+
57
+ connect_service: ConnectService = service_factory.get_connect_service()
58
+
59
+ connect_service.connect_to_entity(
60
+ uid=uid,
61
+ username=username,
62
+ private_key_path=private_ssh_key_path
63
+ )
64
+
65
+
66
+ app_logger.info(f'Stop connect to entity')
67
+ raise typer.Exit(0)