thestage 0.5.39__py3-none-any.whl → 0.5.41__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 CHANGED
@@ -1,3 +1,3 @@
1
1
  from . import *
2
2
  __app_name__ = "thestage"
3
- __version__ = "0.5.39"
3
+ __version__ = "0.5.41"
@@ -6,7 +6,7 @@ from thestage.services.core_files.config_entity import ConfigEntity
6
6
 
7
7
  from thestage.entities.enums.yes_no_response import YesOrNoResponse
8
8
  from thestage.i18n.translation import __
9
- from thestage.helpers.logger.app_logger import app_logger
9
+ from thestage.helpers.logger.app_logger import app_logger, get_log_path_from_os
10
10
  from thestage.services.config_provider.config_provider import ConfigProvider
11
11
  from thestage.services.connect.connect_service import ConnectService
12
12
  from thestage.services.service_factory import ServiceFactory
@@ -40,6 +40,8 @@ def config_get():
40
40
  if config.runtime.config_global_path:
41
41
  typer.echo(__('CONFIG PATH: %path%', {'path': str(config.runtime.config_global_path or '') + f'/config.json'}))
42
42
 
43
+ typer.echo(__('APPLICATION LOGS PATH: %path%', {'path': str(get_log_path_from_os())}))
44
+
43
45
  raise typer.Exit(0)
44
46
 
45
47
 
@@ -107,7 +107,8 @@ def error_handler() -> Callable:
107
107
  else:
108
108
  typer.echo(__('Undefined error occurred'))
109
109
  # typer.echo(e100.__class__.__name__)
110
- print(traceback.format_exc())
110
+ # print(traceback.format_exc())
111
+ # TODO send all exceptions to backend?
111
112
  app_logger.info(f'{traceback.format_exc()}')
112
113
  raise typer.Exit(1)
113
114
  return wrapper
Binary file
@@ -6,6 +6,7 @@ from typing import Optional, List
6
6
  import git
7
7
  import typer
8
8
  from git import Remote, Repo, GitCommandError, Commit
9
+ from gitdb.exc import BadName
9
10
  from rich import print
10
11
 
11
12
  from thestage.color_scheme.color_scheme import ColorScheme
@@ -227,7 +228,10 @@ class GitLocalClient:
227
228
  def get_commit_by_hash(self, path: str, commit_hash: str) -> Optional[Commit]:
228
229
  repo = self.__get_repo(path=path)
229
230
  if repo:
230
- return repo.commit(commit_hash)
231
+ try:
232
+ return repo.commit(commit_hash)
233
+ except BadName as ex:
234
+ return None
231
235
  else:
232
236
  return None
233
237
 
@@ -26,8 +26,6 @@ class ProjectDto(BaseModel):
26
26
  last_task_run_date: Optional[str] = Field(None, alias='lastTaskRunDate')
27
27
  created_at: Optional[str] = Field(None, alias='createdAt')
28
28
  updated_at: Optional[str] = Field(None, alias='updatedAt')
29
- instance_rented_list: List[InstanceRentedDto] = Field(default_factory=list, alias='instanceRentedList')
30
- selfhosted_instance_list: List[SelfHostedInstanceDto] = Field(default_factory=list, alias='selfhostedInstanceList')
31
29
 
32
30
 
33
31
  class ProjectViewResponse(TheStageBaseResponse):
@@ -0,0 +1,6 @@
1
+ from thestage.exceptions.base_exception import BaseAbstractException
2
+
3
+
4
+ class LogPollingException(BaseAbstractException):
5
+ def __init__(self, message: str):
6
+ super(LogPollingException, self).__init__(message=message)
@@ -9,6 +9,7 @@ import typer
9
9
  from httpx import ReadTimeout, ConnectError, ConnectTimeout
10
10
  from requests.exceptions import ChunkedEncodingError
11
11
 
12
+ from thestage.helpers.logger.app_logger import app_logger
12
13
  from thestage.services.clients.thestage_api.dtos.enums.container_status import DockerContainerStatus
13
14
  from thestage.services.core_files.config_entity import ConfigEntity
14
15
  from thestage.services.clients.thestage_api.dtos.enums.inference_simulator_status import InferenceSimulatorStatus
@@ -27,6 +28,7 @@ from thestage.services.clients.thestage_api.api_client import TheStageApiClient
27
28
  from thestage.services.config_provider.config_provider import ConfigProvider
28
29
  from rich import print
29
30
 
31
+ from thestage.services.logging.exception.log_polling_exception import LogPollingException
30
32
  from thestage.services.logging.logging_constants import LOG_MESSAGE_CODE_TASK_FINISHED, \
31
33
  LOG_MESSAGE_CODE_INFERENCE_SIMULATOR_FAILED
32
34
 
@@ -302,6 +304,11 @@ class LoggingService(AbstractService):
302
304
  last_log_id=last_log_id
303
305
  )
304
306
 
307
+ if not logs_response.is_success:
308
+ app_logger.info(f'Polling logs error: {logs_response.message}')
309
+ raise LogPollingException('')
310
+
311
+
305
312
  if consecutive_error_count > 0:
306
313
  consecutive_error_count = 0
307
314
  errors_started_at = None
@@ -323,10 +330,13 @@ class LoggingService(AbstractService):
323
330
 
324
331
  if is_no_more_logs:
325
332
  break
326
- except (ReadTimeout, ConnectError, ConnectTimeout) as e:
333
+ except (ReadTimeout, ConnectError, ConnectTimeout, LogPollingException) as e:
327
334
  consecutive_error_count += 1
328
335
  if consecutive_error_count == 1:
329
- print_nonblocking("Network issues, attempting to re-establish connection...", writer, BytePrintStyle.ORANGE)
336
+ if isinstance(e, LogPollingException):
337
+ print_nonblocking("Some problems raised while getting logs...", writer, BytePrintStyle.ORANGE)
338
+ else:
339
+ print_nonblocking("Network issues, attempting to re-establish connection...", writer, BytePrintStyle.ORANGE)
330
340
  if not errors_started_at:
331
341
  errors_started_at = datetime.utcnow()
332
342
 
@@ -367,13 +367,14 @@ class ProjectService(AbstractService):
367
367
  commit = self.__git_local_client.get_current_commit(path=config.runtime.working_directory)
368
368
  if commit and isinstance(commit, Commit):
369
369
  commit_hash = commit.hexsha
370
- if not task_title:
371
- task_title = commit.message.strip()
372
- else: # if commit_hash is defined
370
+
371
+ commit = self.__git_local_client.get_commit_by_hash(path=config.runtime.working_directory, commit_hash=commit_hash)
372
+ if commit and isinstance(commit, Commit):
373
373
  if not task_title:
374
- commit = self.__git_local_client.get_commit_by_hash(path=config.runtime.working_directory, commit_hash=commit_hash)
375
- if commit and isinstance(commit, Commit):
376
- task_title = commit.message.strip()
374
+ task_title = commit.message.strip()
375
+ else:
376
+ print(f'[red]Error: commit \'{commit_hash}\' was not found in the local repository[/red]')
377
+ raise typer.Exit(0)
377
378
 
378
379
  if not task_title: # should not happen but maybe git allows some kind of empty messages
379
380
  task_title = f'Task_{commit_hash}'
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: thestage
3
- Version: 0.5.39
3
+ Version: 0.5.41
4
4
  Summary:
5
5
  Author: TheStage AI team
6
6
  Author-email: hello@thestage.ai
@@ -10,6 +10,7 @@ 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
13
14
  Requires-Dist: aioconsole (>=0.8.0,<0.9.0)
14
15
  Requires-Dist: boto3 (>=1.35.80,<2.0.0)
15
16
  Requires-Dist: gitpython (>=3.1.40,<4.0.0)
@@ -1,12 +1,11 @@
1
- thestage/.env,sha256=xWuR3yPUo1cjCJ3gDt16DvCfaeHHwzN2flrH-TUpmiQ,177
2
- thestage/__init__.py,sha256=1SqRYS-0qzW4duP0QYAUNGH59XRjGx_5iEStp2t98HM,65
1
+ thestage/__init__.py,sha256=VZwLTO9zP1X39kXdNyRFETyBnYYkrk_E4w1gxiko0qA,65
3
2
  thestage/__main__.py,sha256=4ObdWrDRaIASaR06IxtFSsoMu58eyL0MnD64habvPj8,101
4
3
  thestage/color_scheme/color_scheme.py,sha256=jzdRCX0hi_XStXi4kvPHVItKlTm7dsD3fHIdeRQLeKw,87
5
4
  thestage/config/__init__.py,sha256=RNobilYVK1WAM1utcQ8ZuATKc9Zh9M9BAjCLZTnR_TA,428
6
5
  thestage/config/env_base.py,sha256=RNBQ17yk1ieu1kdUlM7Qe7mDCoxstgGUwwhe265o4dQ,367
7
6
  thestage/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
7
  thestage/controllers/base_controller.py,sha256=lX0XsBc7ZEPD_I56cN8IBAVuWGIkOkr7JHvist3_FEM,2135
9
- thestage/controllers/config_controller.py,sha256=9_IvRO4ag9IsKAIgnNB5Vt9CeTVRpYrxnGR80iDeQ9w,5251
8
+ thestage/controllers/config_controller.py,sha256=Gzd61UeU1igFT4QUyrZ4dOo_QaNEuXuSEIroXpbBhPA,5365
10
9
  thestage/controllers/container_controller.py,sha256=C3WC-Ypeg-vpC8LyCcPZVszbiaDYf2aQzTxYC2PPG8g,15210
11
10
  thestage/controllers/instance_controller.py,sha256=pFhkO7U2Ta0_1dzskEj8hbE7Izw_7I4SDbq5O5-bfIY,9757
12
11
  thestage/controllers/project_controller.py,sha256=M15b-VhThEhI1eOTX7r3njFnHAWK-tcLc23etOOKTj0,32527
@@ -36,7 +35,7 @@ thestage/exceptions/http_error_exception.py,sha256=24R8KYC5nU8T1zDE9xtThM9SAA3PG
36
35
  thestage/exceptions/remote_server_exception.py,sha256=Z1R5Wjw3w7VdqURhjidGkNhJL9lsA76txkAZPA5Uv70,595
37
36
  thestage/git/ProgressPrinter.py,sha256=z99BPq3KYycClL-7fmsERIIuZ03papdIYOhR8A7b9AA,573
38
37
  thestage/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- thestage/helpers/error_handler.py,sha256=igSl0ex4Wm_sDC0O-R7KTvBibkEi1HEDLXX66EoNJP4,5280
38
+ thestage/helpers/error_handler.py,sha256=ZnCrMcGEtEbVc_-yA7utUQr6jVSfey_J__siAB_rxiA,5341
40
39
  thestage/helpers/logger/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
40
  thestage/helpers/logger/app_logger.py,sha256=hUuxgUsj4pl9Ogjt1xJePTf71iVxKzyx46dr1QZ7E28,1560
42
41
  thestage/helpers/ssh_util.py,sha256=JuDwddHxEGcA24Y8a-jLv339cG-jq4hEaBAl5TSVVFw,1262
@@ -48,10 +47,10 @@ thestage/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
48
47
  thestage/services/abstract_mapper.py,sha256=_q7YLkPNRsNW5wOCqvZIu1KfpLkc7uVaAQKrMZtsGuY,218
49
48
  thestage/services/abstract_service.py,sha256=1PBkO8pFkPmNk1VxUIxED0H3ZStCqAcFw7QGBlzkoh4,3963
50
49
  thestage/services/app_config_service.py,sha256=a7zrbVCJx6XCSRCMv346AYQ_gV3fzw8g7EzunZJ-CIY,1655
51
- thestage/services/clients/.DS_Store,sha256=nzq5skCC7S6pAZDF-RZCYmSwpDp-fIu7x4M5OFfbBUA,6148
50
+ thestage/services/clients/.DS_Store,sha256=EYALnKLNXhZ-2jJTMck8Fo1bIxlFCvaXGUUUf-lgHxM,6148
52
51
  thestage/services/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
52
  thestage/services/clients/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- thestage/services/clients/git/git_client.py,sha256=ZuoUWXctBIhRyMBde13ebMArYzMu-8vdUM7vY8IHUAY,11624
53
+ thestage/services/clients/git/git_client.py,sha256=-5WSoDj0Fi6PJD_Eo04ne83Z6IGQ85qa4eVmIsLnpb4,11737
55
54
  thestage/services/clients/thestage_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
55
  thestage/services/clients/thestage_api/api_client.py,sha256=BSxG6_FzoTCBub-24Hffwo6IsfAPhdzYqpfpediWucY,29396
57
56
  thestage/services/clients/thestage_api/core/api_client_abstract.py,sha256=nJ0OiT4Ecexp-3HHK332pvyzrf1JsZ1WQYdvn-aeIL8,2984
@@ -119,7 +118,7 @@ thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_
119
118
  thestage/services/clients/thestage_api/dtos/project_controller/project_run_task_response.py,sha256=iISmJTHbxSRJsXHT4qBTMP3-Co9fWCHI5s2UgB_-GV8,340
120
119
  thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_request.py,sha256=YtyM678EYehdCNAiwrEbWsXNsoRDtWeW1t96V7LLAFw,525
121
120
  thestage/services/clients/thestage_api/dtos/project_controller/project_start_inference_simulator_response.py,sha256=Q7XlbZ4vgk9QQL2z11BeUkKDn-5p8j06eNI0GmpZNjk,430
122
- thestage/services/clients/thestage_api/dtos/project_response.py,sha256=GoQ_qd90eanDONK_GrsIIW4gHQrKIOn4FPuP4l5dZZk,1919
121
+ thestage/services/clients/thestage_api/dtos/project_response.py,sha256=PQ0L14_8akc5ADZeL_Y15Z2Hlvkt54d0YKfPROJZQHk,1691
123
122
  thestage/services/clients/thestage_api/dtos/selfhosted_instance_response.py,sha256=iDo2AFlUr2WV7vhBU40Abyp1AFoEk986UQRb5O0as4U,3049
124
123
  thestage/services/clients/thestage_api/dtos/sftp_path_helper.py,sha256=UeCEcE_qR_TcOGFyOLef7cz3veh1_o6MnLbAJyZk2yc,362
125
124
  thestage/services/clients/thestage_api/dtos/ssh_key_controller/add_ssh_key_to_user_request.py,sha256=BmO99BXrbUCb2ZIYS2oc7xkwWb5CV5WCaqt1xO4yIro,234
@@ -151,8 +150,9 @@ thestage/services/instance/mapper/selfhosted_mapper.py,sha256=KpkvsDV0OWzHhN53md
151
150
  thestage/services/logging/byte_print_style.py,sha256=vUimuC3ZgGujtweQxiRcUXEGlb2yKwv9LRYMy7Gtzhg,139
152
151
  thestage/services/logging/dto/log_message.py,sha256=k2clfz2fQnQ-ycFI8g8WYJ_XOjK0hhlA5VhwxVYByaQ,453
153
152
  thestage/services/logging/dto/log_type.py,sha256=a6JWnq0ZjJ-2BQrG-fKYYy3UeJS2U2ZzE5P_EXglBfE,95
153
+ thestage/services/logging/exception/log_polling_exception.py,sha256=rKQ7AtNCGKkk5OINIyyjvLT92PU5i_yJUH-Msr9hXQw,226
154
154
  thestage/services/logging/logging_constants.py,sha256=4Gk2tglHW_-jnjB8uVIh-ds4fAVBqNW8igfQt8k7Quc,137
155
- thestage/services/logging/logging_service.py,sha256=9n-X9UsWJB-2b36s9j7JMQaSeA7nvz1yM2FTIZBVxzQ,18014
155
+ thestage/services/logging/logging_service.py,sha256=nan5ycoaKbNyJx0lcxO99zJFVxNtV_rHfjBIqJqXQ6w,18576
156
156
  thestage/services/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
157
  thestage/services/project/dto/inference_simulator_dto.py,sha256=5U4uGp7VC1Yr-T0fqZiSNqZUIybs4J9sV25vjBbAUxI,1312
158
158
  thestage/services/project/dto/inference_simulator_model_dto.py,sha256=j4dT-7cduzLd59QnmnfQt_aFsiUucpyJFGb-9rNx5K8,1172
@@ -161,13 +161,13 @@ thestage/services/project/mapper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
161
161
  thestage/services/project/mapper/project_inference_simulator_mapper.py,sha256=UdOu9IIF5rlNPoWSaaeSKU3ODe8E5uSMgm2V5ywMWKE,812
162
162
  thestage/services/project/mapper/project_inference_simulator_model_mapper.py,sha256=PWY0iWbXhvD-G0X0_aQZAFY2bqc0lvRJcQAyC8Y-88Q,869
163
163
  thestage/services/project/mapper/project_task_mapper.py,sha256=SHIEXjYwt4vm2B1X2QiI4sCPbBarum0bTOnmTWPOlto,813
164
- thestage/services/project/project_service.py,sha256=qMMYKgmzlEwtsTsHr4arQP2JeBftq0n5M0XAVsK3cZA,50670
164
+ thestage/services/project/project_service.py,sha256=vdHb9YB4yfw5UlOIa95M-CJLb3mQZIHn5hLhevagC5A,50666
165
165
  thestage/services/remote_server_service.py,sha256=3VPgd9ckxXOxXGGvb3JeJ0LwuZx2gd2jWn3Pf-CxqVk,23264
166
166
  thestage/services/service_factory.py,sha256=tWbFFDO6TeOz5jSYbe-OabqTmsjR9Xs1OZmd49Aj3g0,5098
167
167
  thestage/services/task/dto/task_dto.py,sha256=PJwrUsLLAoO2uA9xvzb27b9iYAoNiBcsHSxKERh2VFo,2335
168
168
  thestage/services/validation_service.py,sha256=ABb-ok-SGITE6jm8AR1hiYHYgGZL7ri02Yi0OCXbofo,2008
169
- thestage-0.5.39.dist-info/LICENSE.txt,sha256=U9QrxfdD7Ie7r8z1FleuvOGQvgCF1m0Mjd78cFvWaHE,572
170
- thestage-0.5.39.dist-info/METADATA,sha256=Lh0aT0TR8Hd1eUg_IhJtk1FIeJ7b8QIeyPtLqlriPnQ,5506
171
- thestage-0.5.39.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
172
- thestage-0.5.39.dist-info/entry_points.txt,sha256=57pMhs8zaCM-jgeTffC0WVqCsh35Uq_dUDmzXR80CI4,47
173
- thestage-0.5.39.dist-info/RECORD,,
169
+ thestage-0.5.41.dist-info/LICENSE.txt,sha256=U9QrxfdD7Ie7r8z1FleuvOGQvgCF1m0Mjd78cFvWaHE,572
170
+ thestage-0.5.41.dist-info/METADATA,sha256=as8bA9PG2EvbCpYXW_0cGMWLSa0b6tWwE3qwawxP9h8,5557
171
+ thestage-0.5.41.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
172
+ thestage-0.5.41.dist-info/entry_points.txt,sha256=57pMhs8zaCM-jgeTffC0WVqCsh35Uq_dUDmzXR80CI4,47
173
+ thestage-0.5.41.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
thestage/.env DELETED
@@ -1,5 +0,0 @@
1
- THESTAGE_CONFIG_DIR=.thestage
2
- THESTAGE_CONFIG_FILE=config.json
3
- THESTAGE_API_URL=https://backend-staging3.thestage.ai
4
- THESTAGE_API_URL=http://localhost:8100
5
- LOG_FILE=thestage.log