arpakitlib 1.7.35__py3-none-any.whl → 1.7.37__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.
@@ -1,8 +1,9 @@
1
+ from arpakitlib.ar_json_util import safely_transfer_to_json_str
1
2
  from src.core.settings import get_cached_settings
2
3
 
3
4
 
4
5
  def command():
5
- print(get_cached_settings())
6
+ print(safely_transfer_to_json_str(get_cached_settings().model_dump(mode="json")))
6
7
 
7
8
 
8
9
  if __name__ == '__main__':
@@ -85,7 +85,7 @@ def create_api_app() -> FastAPI:
85
85
 
86
86
  shutdown_api_events = []
87
87
 
88
- startup_api_events.append(ShutdownAPIEvent(transmitted_api_data=transmitted_api_data))
88
+ shutdown_api_events.append(ShutdownAPIEvent(transmitted_api_data=transmitted_api_data))
89
89
 
90
90
  api_app = create_fastapi_app(
91
91
  title=settings.api_title.strip(),
@@ -14,7 +14,7 @@ class Settings(SimpleSettings):
14
14
 
15
15
  sql_db_echo: bool = False
16
16
 
17
- api_init_sql_db_at_start: bool = False
17
+ api_init_sql_db_at_start: bool = True
18
18
 
19
19
  api_title: str = "{PROJECT_NAME}"
20
20
 
@@ -56,6 +56,7 @@ class BaseWorker(ABC):
56
56
  self._logger.exception(exception)
57
57
 
58
58
  def sync_safe_run(self):
59
+ self._logger.info("sync_safe_run")
59
60
  self.sync_on_startup()
60
61
  while True:
61
62
  try:
@@ -77,6 +78,7 @@ class BaseWorker(ABC):
77
78
  self._logger.exception(exception)
78
79
 
79
80
  async def async_safe_run(self):
81
+ self._logger.info("async_safe_run")
80
82
  await self.async_on_startup()
81
83
  while True:
82
84
  try:
@@ -96,7 +96,7 @@ class BaseOperationExecutor:
96
96
  try:
97
97
  self.sync_execute_operation(operation_dbm=operation_dbm)
98
98
  except BaseException as exception_:
99
- self._logger.exception(exception_)
99
+ self._logger.error(f"Error while executing operation (id={operation_dbm.id})", exc_info=exception_)
100
100
  exception = exception_
101
101
  traceback_str = traceback.format_exc()
102
102
 
@@ -116,25 +116,27 @@ class BaseOperationExecutor:
116
116
  operation_dbm.status = OperationDBM.Statuses.executed_without_error
117
117
  session.commit()
118
118
 
119
- story_log_dbm = StoryLogDBM(
120
- level=StoryLogDBM.Levels.error,
121
- title="Error in sync_execute_operation",
122
- data={
123
- "operation_id": operation_dbm.id,
124
- "exception_str": str(exception),
125
- "traceback_str": traceback_str
126
- }
127
- )
128
- session.add(story_log_dbm)
129
- session.commit()
119
+ if exception:
120
+ story_log_dbm = StoryLogDBM(
121
+ level=StoryLogDBM.Levels.error,
122
+ title=f"Error while executing operation (id={operation_dbm.id}, type={operation_dbm.type})",
123
+ data={
124
+ "operation_id": operation_dbm.id,
125
+ "exception_str": str(exception),
126
+ "traceback_str": traceback_str
127
+ }
128
+ )
129
+ session.add(story_log_dbm)
130
+ session.commit()
131
+ session.refresh(story_log_dbm)
130
132
 
131
133
  session.refresh(operation_dbm)
132
- session.refresh(story_log_dbm)
133
134
 
134
135
  self._logger.info(
135
136
  f"finish sync_safe_execute_operation"
136
137
  f", operation_dbm.id={operation_dbm.id}"
137
138
  f", operation_dbm.type={operation_dbm.type}"
139
+ f", operation_dbm.status={operation_dbm.status}"
138
140
  f", operation_dbm.duration={operation_dbm.duration}"
139
141
  )
140
142
 
@@ -170,7 +172,7 @@ class BaseOperationExecutor:
170
172
  try:
171
173
  await self.async_execute_operation(operation_dbm=operation_dbm)
172
174
  except BaseException as exception_:
173
- self._logger.exception(exception_)
175
+ self._logger.error(f"Error while executing operation (id={operation_dbm.id})", exc_info=exception_)
174
176
  exception = exception_
175
177
  traceback_str = traceback.format_exc()
176
178
 
@@ -190,25 +192,28 @@ class BaseOperationExecutor:
190
192
  operation_dbm.status = OperationDBM.Statuses.executed_without_error
191
193
  session.commit()
192
194
 
193
- story_log_dbm = StoryLogDBM(
194
- level=StoryLogDBM.Levels.error,
195
- title="Error in async_execute_operation",
196
- data={
197
- "operation_id": operation_dbm.id,
198
- "exception_str": str(exception),
199
- "traceback_str": traceback_str
200
- }
201
- )
202
- session.add(story_log_dbm)
203
- session.commit()
195
+ if exception:
196
+ story_log_dbm = StoryLogDBM(
197
+ level=StoryLogDBM.Levels.error,
198
+ title=f"Error while executing operation (id={operation_dbm.id}, type={operation_dbm.type})",
199
+ data={
200
+ "operation_id": operation_dbm.id,
201
+ "exception_str": str(exception),
202
+ "traceback_str": traceback_str
203
+ }
204
+ )
205
+ session.add(story_log_dbm)
206
+ session.commit()
207
+ session.refresh(story_log_dbm)
204
208
 
205
209
  session.refresh(operation_dbm)
206
- session.refresh(story_log_dbm)
207
210
 
208
211
  self._logger.info(
209
212
  f"finish async_safe_execute_operation"
210
213
  f", operation_dbm.id={operation_dbm.id}"
211
214
  f", operation_dbm.type={operation_dbm.type}"
215
+ f", operation_dbm.status={operation_dbm.status}"
216
+ f", operation_dbm.duration={operation_dbm.duration}"
212
217
  )
213
218
 
214
219
  return operation_dbm
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arpakitlib
3
- Version: 1.7.35
3
+ Version: 1.7.37
4
4
  Summary: arpakitlib
5
5
  Home-page: https://github.com/ARPAKIT-Company/arpakitlib
6
6
  License: Apache-2.0
@@ -7,7 +7,6 @@ arpakitlib/_arpakit_project_template/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaW
7
7
  arpakitlib/_arpakit_project_template/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
8
8
  arpakitlib/_arpakit_project_template/README.md,sha256=EEoHPZrJQtLS3fKD3JvoPhkGhjfuDihxK5fmAGwihCQ,65
9
9
  arpakitlib/_arpakit_project_template/example.env,sha256=9JQcdFX1ChuOZ1WVIJj89xg71xDnb-TRi8LYGje9TDM,232
10
- arpakitlib/_arpakit_project_template/example_pyproject.toml,sha256=wLzoszIWqIC8qwgJD7FH_2UzKVh4PB7gi030zO6aYbA,485
11
10
  arpakitlib/_arpakit_project_template/manage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
11
  arpakitlib/_arpakit_project_template/manage/docker_ps.sh,sha256=uwm8vHgeuNLCOn0o9hgP_uc-PUkS9FwLyzZh6ItZ3do,15
13
12
  arpakitlib/_arpakit_project_template/manage/docker_ps_a.sh,sha256=nOQejihYlzstg9oROvYwHIsSLt2Sw0DWQEeT3GBaBNs,18
@@ -16,6 +15,7 @@ arpakitlib/_arpakit_project_template/manage/docker_start_postgres_for_dev.sh,sha
16
15
  arpakitlib/_arpakit_project_template/manage/docker_stop_postgres_for_dev.sh,sha256=Mlerpr5giJvpAtmYsudx-bYb4SuL1Hw7iF1Jv_b061k,41
17
16
  arpakitlib/_arpakit_project_template/manage/example_nginx_proxy.nginx,sha256=Ch4vCoa1QBdDpfRAz2tgOMO8Gw-6tgNyvOkte7A3MsA,326
18
17
  arpakitlib/_arpakit_project_template/manage/example_poetry_arpakitlib.sh,sha256=ChcLbdsciCUlv_k-gp_1n70K80xc-ulKz4MXz-hXMqs,206
18
+ arpakitlib/_arpakit_project_template/manage/example_pyproject.toml,sha256=wLzoszIWqIC8qwgJD7FH_2UzKVh4PB7gi030zO6aYbA,485
19
19
  arpakitlib/_arpakit_project_template/manage/example_systemd.service,sha256=Cunp3074ZKg1AQiX4Q_Xe5Q39Jca7hQj5ljXqryWwTU,143
20
20
  arpakitlib/_arpakit_project_template/manage/git_branch.sh,sha256=yMwBwT866WjxowbDrNHRDh8yod4eSn7JZnXUlQvrcOk,17
21
21
  arpakitlib/_arpakit_project_template/manage/git_commit.sh,sha256=AW1NEel-ZHaYeVWFlRbgZSYPQdnVKsTkpR_07RQL1Mw,42
@@ -58,7 +58,7 @@ arpakitlib/_arpakit_project_template/manage/sandbox/sandbox_6.py,sha256=WdE1IWyO
58
58
  arpakitlib/_arpakit_project_template/manage/sandbox/sandbox_7.py,sha256=WdE1IWyObxVUT9jE3qgNMaFXXkKV6nUI0ZToLT1uhdk,155
59
59
  arpakitlib/_arpakit_project_template/manage/sandbox/sandbox_8.sh,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  arpakitlib/_arpakit_project_template/manage/sandbox/sandbox_9.sh,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
- arpakitlib/_arpakit_project_template/manage/settings_check.py,sha256=JYR-IPgvYQOmJedKY9vOctbxEcUlaxZR-P0JXT9L2JQ,143
61
+ arpakitlib/_arpakit_project_template/manage/settings_check.py,sha256=DeOGoWXgk2_VXpCIFbQgf1k2zcnv4hOLWIVc5BDv80c,260
62
62
  arpakitlib/_arpakit_project_template/manage/settings_generate_env_example.py,sha256=pRTr6SzBJxDUaxTXZgLJr7rJawHyvpyTJbrJSZW0hEc,330
63
63
  arpakitlib/_arpakit_project_template/manage/sqlalchemy_db_check_conn.py,sha256=3Q4QfvFVBZsbMMH5yr6v3a6v6UjQuIEIujlxGpvykNA,190
64
64
  arpakitlib/_arpakit_project_template/manage/sqlalchemy_db_init.py,sha256=FqKVuakafDndHKBsyPcSowhss6MZb0Soy5oREUPVLUw,184
@@ -71,7 +71,7 @@ arpakitlib/_arpakit_project_template/src/additional_model/__init__.py,sha256=47D
71
71
  arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py,sha256=4KCOvto9Hj5eMYpvfaJChghhR9bkCvKluGGPWrTezoY,134
72
72
  arpakitlib/_arpakit_project_template/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  arpakitlib/_arpakit_project_template/src/api/asgi.py,sha256=a5UBxOyNC8NG3E0ayhiDo3t5tPoB3WtOf2gbZJFWBAA,74
74
- arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=GiGYR6Co5F1BfIyWK3_qqhcw9TlfsQedv2_YQVqtFnM,4414
74
+ arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=eUky7ReRLg6LtiuZHBQvDUmOhhlfDLr9eVaB_h-VjFU,4415
75
75
  arpakitlib/_arpakit_project_template/src/api/event.py,sha256=58wCVyVSIe_kydWi44M0Wvp7bTnV8xvO30gMXzjbFYc,750
76
76
  arpakitlib/_arpakit_project_template/src/api/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  arpakitlib/_arpakit_project_template/src/api/router/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -85,7 +85,7 @@ arpakitlib/_arpakit_project_template/src/api/transmitted_api_data.py,sha256=YtpA
85
85
  arpakitlib/_arpakit_project_template/src/business_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  arpakitlib/_arpakit_project_template/src/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  arpakitlib/_arpakit_project_template/src/core/const.py,sha256=CZZew674y7LhCAlYhvuF5cV4Zb9nQ17j2Tcuj2GEBf4,1232
88
- arpakitlib/_arpakit_project_template/src/core/settings.py,sha256=CDNllVPKvP-3LabGv3CFJodKhZtQ7R_umLgQ7rr-xN4,1748
88
+ arpakitlib/_arpakit_project_template/src/core/settings.py,sha256=1xYMyH99GrLVyzkiz8dFJ3YuC_mFWcMEswKpRxuPgFQ,1747
89
89
  arpakitlib/_arpakit_project_template/src/core/util.py,sha256=I5Cxd-lXVMnpjMOyfoNcfOdL05xrujXBmYi5d91AjJg,1714
90
90
  arpakitlib/_arpakit_project_template/src/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
91
  arpakitlib/_arpakit_project_template/src/db/sqlalchemy_model.py,sha256=nXtayUkBaVb6tWx5qJgXZLbLOTVAjnSLpSDxBm7yZLc,234
@@ -110,7 +110,7 @@ arpakitlib/ar_arpakit_project_template_util.py,sha256=p_Xl6snazS17UwX0EI5M0mPE_G
110
110
  arpakitlib/ar_arpakit_schedule_uust_api_client_util.py,sha256=SYWWQDohPnw0qpBIu2hEvGZRVdaI4NUUQdEjnMnseo4,18237
111
111
  arpakitlib/ar_arpakitlib_cli_util.py,sha256=h1Iby85XsNjEy88ABZqYQr5fDfdtbysnkxsbTZfOaHI,2985
112
112
  arpakitlib/ar_base64_util.py,sha256=aZkg2cZTuAaP2IWeG_LXJ6RO7qhyskVwec-Lks0iM-k,676
113
- arpakitlib/ar_base_worker_util.py,sha256=fW7kzbo7gKFaF7-l7DnOGTVkt4H_BeHSkTHSoGQR8Fw,3295
113
+ arpakitlib/ar_base_worker_util.py,sha256=vb7JrqiYvG7yw7-gZAP-oFwEEMqOuBGCpMJ5lw8wF-E,3382
114
114
  arpakitlib/ar_cache_file_util.py,sha256=Fo2pH-Zqm966KWFBHG_pbiySGZvhIFCYqy7k1weRfJ0,3476
115
115
  arpakitlib/ar_datetime_util.py,sha256=Xe1NiT9oPQzNSG7RVRkhukhbg4i-hhS5ImmV7sPUc8o,971
116
116
  arpakitlib/ar_dict_util.py,sha256=cF5LQJ6tLqyGoEXfDljMDZrikeZoWPw7CgINHIFGvXM,419
@@ -151,7 +151,7 @@ arpakitlib/ar_logging_util.py,sha256=Gyd7B9k0glIXPm6dASiigWLq9LC9lw6vhXTCeWpY5PY
151
151
  arpakitlib/ar_mongodb_util.py,sha256=2ECkTnGAZ92qxioL-fmN6R4yZOSr3bXdXLWTzT1C3vk,4038
152
152
  arpakitlib/ar_need_type_util.py,sha256=xq5bbAXJG-93CRVZUcLW0ZdM22rj-ZUW17C5hX_5grg,1699
153
153
  arpakitlib/ar_openai_api_client_util.py,sha256=dHUbfg1sVVCjsNl_fra3iCMEz1bR-Hk9fE-DdYbu7Wc,1215
154
- arpakitlib/ar_operation_execution_util.py,sha256=eDGVEFYDO3pFyCg7WGUglyBLs6QkHSYNpAmGpT0zqp4,12883
154
+ arpakitlib/ar_operation_execution_util.py,sha256=Zny68a2O6ZxMMW9gOfH5WaNoHFgJtWe0Q62_J16YNd4,13451
155
155
  arpakitlib/ar_parse_command.py,sha256=-s61xcATIsfw1eV_iD3xi-grsitbGzSDoAFc5V0OFy4,3447
156
156
  arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
157
157
  arpakitlib/ar_run_cmd_util.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g,1072
@@ -165,9 +165,9 @@ arpakitlib/ar_str_util.py,sha256=oCEtQ_TTn35OEz9jCNLjbhopq76JmaifD_iYR-nEJJ4,214
165
165
  arpakitlib/ar_type_util.py,sha256=GNc9PgFKonj5lRlAHSnVPBN5nLIslrG8GTiZHjkf05w,2138
166
166
  arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
167
167
  arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
168
- arpakitlib-1.7.35.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
169
- arpakitlib-1.7.35.dist-info/METADATA,sha256=nDzRnz4ZaZA4eaV8SA-DettkNooOL6i9alsGt2evA1U,2824
170
- arpakitlib-1.7.35.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
171
- arpakitlib-1.7.35.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
- arpakitlib-1.7.35.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
173
- arpakitlib-1.7.35.dist-info/RECORD,,
168
+ arpakitlib-1.7.37.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
169
+ arpakitlib-1.7.37.dist-info/METADATA,sha256=UDFYfjNJd62DVxCg7N2KF4tnsXZuxQA_I_axAkQQh1g,2824
170
+ arpakitlib-1.7.37.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
171
+ arpakitlib-1.7.37.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
+ arpakitlib-1.7.37.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
173
+ arpakitlib-1.7.37.dist-info/RECORD,,