arpakitlib 1.7.90__py3-none-any.whl → 1.7.93__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.
- arpakitlib/_arpakit_project_template/src/api/router/main_router.py +3 -0
- arpakitlib/ar_base_worker_util.py +1 -1
- arpakitlib/ar_operation_execution_util.py +14 -4
- arpakitlib/ar_schedule_uust_api_client_util.py +13 -6
- arpakitlib/ar_sqlalchemy_model_util.py +5 -3
- {arpakitlib-1.7.90.dist-info → arpakitlib-1.7.93.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.90.dist-info → arpakitlib-1.7.93.dist-info}/RECORD +11 -11
- {arpakitlib-1.7.90.dist-info → arpakitlib-1.7.93.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.90.dist-info → arpakitlib-1.7.93.dist-info}/NOTICE +0 -0
- {arpakitlib-1.7.90.dist-info → arpakitlib-1.7.93.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.90.dist-info → arpakitlib-1.7.93.dist-info}/entry_points.txt +0 -0
@@ -11,6 +11,7 @@ from typing import Any, Callable
|
|
11
11
|
from pydantic import ConfigDict
|
12
12
|
from pydantic.v1 import BaseModel
|
13
13
|
from sqlalchemy import asc
|
14
|
+
from sqlalchemy.exc import NoResultFound
|
14
15
|
from sqlalchemy.orm import Session
|
15
16
|
|
16
17
|
from arpakitlib.ar_base_worker_util import BaseWorker
|
@@ -61,7 +62,8 @@ def get_operation_by_id(
|
|
61
62
|
session: Session | None = None,
|
62
63
|
sqlalchemy_db: SQLAlchemyDB | None = None,
|
63
64
|
filter_operation_id: int,
|
64
|
-
raise_if_not_found: bool = False
|
65
|
+
raise_if_not_found: bool = False,
|
66
|
+
lock: bool = False
|
65
67
|
) -> OperationDBM | None:
|
66
68
|
def func(session_: Session):
|
67
69
|
query = (
|
@@ -69,8 +71,16 @@ def get_operation_by_id(
|
|
69
71
|
.query(OperationDBM)
|
70
72
|
.filter(OperationDBM.id == filter_operation_id)
|
71
73
|
)
|
74
|
+
|
75
|
+
if lock:
|
76
|
+
query = query.with_for_update()
|
77
|
+
|
72
78
|
if raise_if_not_found:
|
73
|
-
|
79
|
+
try:
|
80
|
+
return query.one()
|
81
|
+
except NoResultFound:
|
82
|
+
if raise_if_not_found:
|
83
|
+
raise ValueError("Operation not found")
|
74
84
|
else:
|
75
85
|
return query.one_or_none()
|
76
86
|
|
@@ -305,7 +315,7 @@ class OperationExecutorWorker(BaseWorker):
|
|
305
315
|
sqlalchemy_db: SQLAlchemyDB,
|
306
316
|
operation_executor: BaseOperationExecutor | None = None,
|
307
317
|
filter_operation_types: str | list[str] | None = None,
|
308
|
-
timeout_after_run=timedelta(seconds=0.
|
318
|
+
timeout_after_run=timedelta(seconds=0.3),
|
309
319
|
timeout_after_err_in_run=timedelta(seconds=1),
|
310
320
|
startup_funcs: list[Any] | None = None
|
311
321
|
):
|
@@ -374,7 +384,7 @@ class ScheduledOperationCreatorWorker(BaseWorker):
|
|
374
384
|
*,
|
375
385
|
sqlalchemy_db: SQLAlchemyDB,
|
376
386
|
scheduled_operations: list[ScheduledOperation] | None = None,
|
377
|
-
timeout_after_run=timedelta(seconds=0.
|
387
|
+
timeout_after_run=timedelta(seconds=0.3),
|
378
388
|
timeout_after_err_in_run=timedelta(seconds=1),
|
379
389
|
startup_funcs: list[Any] | None = None
|
380
390
|
):
|
@@ -189,18 +189,25 @@ class ScheduleUUSTAPIClient:
|
|
189
189
|
return False
|
190
190
|
return True
|
191
191
|
|
192
|
-
async def check_all(self):
|
192
|
+
async def check_all(self) -> dict[str, Any]:
|
193
|
+
current_semester = await self.get_current_semester()
|
194
|
+
self._logger.info(f"current_semester: {current_semester}")
|
195
|
+
|
196
|
+
current_week = await self.get_current_week()
|
197
|
+
self._logger.info(f"current_week: {current_week}")
|
198
|
+
|
193
199
|
groups = await self.get_groups()
|
194
200
|
self._logger.info(f"groups len: {len(groups)}")
|
195
201
|
|
196
202
|
teachers = await self.get_teachers()
|
197
203
|
self._logger.info(f"teachers len: {len(teachers)}")
|
198
204
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
205
|
+
return {
|
206
|
+
"current_semester": current_semester,
|
207
|
+
"current_week": current_week,
|
208
|
+
"len(groups)": len(groups),
|
209
|
+
"len(teachers)": len(teachers)
|
210
|
+
}
|
204
211
|
|
205
212
|
|
206
213
|
def __example():
|
@@ -4,7 +4,7 @@ from datetime import datetime, timedelta
|
|
4
4
|
from typing import Any
|
5
5
|
from uuid import uuid4
|
6
6
|
|
7
|
-
from sqlalchemy import inspect, INTEGER, TEXT, TIMESTAMP
|
7
|
+
from sqlalchemy import inspect, INTEGER, TEXT, TIMESTAMP, func
|
8
8
|
from sqlalchemy.dialects.postgresql import JSONB
|
9
9
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
10
10
|
|
@@ -78,10 +78,12 @@ class SimpleDBM(BaseDBM):
|
|
78
78
|
INTEGER, primary_key=True, autoincrement=True, sort_order=-3, nullable=False
|
79
79
|
)
|
80
80
|
long_id: Mapped[str] = mapped_column(
|
81
|
-
TEXT, insert_default=generate_default_long_id,
|
81
|
+
TEXT, insert_default=generate_default_long_id, server_default=func.gen_random_uuid(),
|
82
|
+
unique=True, sort_order=-2, nullable=False
|
82
83
|
)
|
83
84
|
creation_dt: Mapped[datetime] = mapped_column(
|
84
|
-
TIMESTAMP(timezone=True), insert_default=now_utc_dt,
|
85
|
+
TIMESTAMP(timezone=True), insert_default=now_utc_dt, server_default=func.now(),
|
86
|
+
index=True, sort_order=-1, nullable=False
|
85
87
|
)
|
86
88
|
|
87
89
|
def __repr__(self):
|
@@ -78,7 +78,7 @@ arpakitlib/_arpakit_project_template/src/api/const.py,sha256=7d4qD5hedqr7QxVzbfs
|
|
78
78
|
arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=lDE77W6WkeAeRB_vJY3TXRTa3HeiO-t26eTtG7v8j6U,4594
|
79
79
|
arpakitlib/_arpakit_project_template/src/api/event.py,sha256=58wCVyVSIe_kydWi44M0Wvp7bTnV8xvO30gMXzjbFYc,750
|
80
80
|
arpakitlib/_arpakit_project_template/src/api/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
|
-
arpakitlib/_arpakit_project_template/src/api/router/main_router.py,sha256=
|
81
|
+
arpakitlib/_arpakit_project_template/src/api/router/main_router.py,sha256=Yv699WCJDcdiJMXFg1kPTvolqj-NAGoXfqe-vzbMzIU,228
|
82
82
|
arpakitlib/_arpakit_project_template/src/api/router/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
83
83
|
arpakitlib/_arpakit_project_template/src/api/router/v1/get_api_error_info.py,sha256=lz2yH5IjzKvkdAqOErnT4E4DCTwmE1Ru0h_7dc_ZNn4,844
|
84
84
|
arpakitlib/_arpakit_project_template/src/api/router/v1/main_router.py,sha256=fvT-t2c2o6XVVJWiUdNnIWEOE8Q8F4v1Ik1Nae5YqvU,256
|
@@ -120,7 +120,7 @@ arpakitlib/ar_arpakit_project_template_util.py,sha256=AswzQvvb-zfUyrcP4EP0K756YL
|
|
120
120
|
arpakitlib/ar_arpakit_schedule_uust_api_client_util.py,sha256=jGbP6egs2yhgfheyqhM0J-SeM2qp2YrW7dV-u9djv4Q,19223
|
121
121
|
arpakitlib/ar_arpakitlib_cli_util.py,sha256=8lhEDxnwMSRX2PGV2xQtQru1AYKSA92SVolol5u7iBk,3154
|
122
122
|
arpakitlib/ar_base64_util.py,sha256=aZkg2cZTuAaP2IWeG_LXJ6RO7qhyskVwec-Lks0iM-k,676
|
123
|
-
arpakitlib/ar_base_worker_util.py,sha256=
|
123
|
+
arpakitlib/ar_base_worker_util.py,sha256=3pK03ps_AwtdDJofA8mRIGqlEDR1mfWd_QsSS3IR6sM,4828
|
124
124
|
arpakitlib/ar_cache_file_util.py,sha256=Fo2pH-Zqm966KWFBHG_pbiySGZvhIFCYqy7k1weRfJ0,3476
|
125
125
|
arpakitlib/ar_datetime_util.py,sha256=Xe1NiT9oPQzNSG7RVRkhukhbg4i-hhS5ImmV7sPUc8o,971
|
126
126
|
arpakitlib/ar_dict_util.py,sha256=cF5LQJ6tLqyGoEXfDljMDZrikeZoWPw7CgINHIFGvXM,419
|
@@ -164,23 +164,23 @@ arpakitlib/ar_logging_util.py,sha256=mx3H6CzX9dsh29ruFmYnva8lL6mwvdBXmeHH9E2tvu8
|
|
164
164
|
arpakitlib/ar_mongodb_util.py,sha256=2ECkTnGAZ92qxioL-fmN6R4yZOSr3bXdXLWTzT1C3vk,4038
|
165
165
|
arpakitlib/ar_need_type_util.py,sha256=GETiREPMEYhch-yU6T--Bdawlbb04Jp1Qy7cOsUlIeA,2228
|
166
166
|
arpakitlib/ar_openai_api_client_util.py,sha256=_XmlApvHFMSyjvZydPa_kASIt9LsFrZmSC7YEzIG8Bg,1806
|
167
|
-
arpakitlib/ar_operation_execution_util.py,sha256=
|
167
|
+
arpakitlib/ar_operation_execution_util.py,sha256=D0pUb0hJ7VRsBrq1tiW5otPJMSqZdPDQLUnlPJxkAL0,18242
|
168
168
|
arpakitlib/ar_parse_command.py,sha256=-s61xcATIsfw1eV_iD3xi-grsitbGzSDoAFc5V0OFy4,3447
|
169
169
|
arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
|
170
170
|
arpakitlib/ar_run_cmd_util.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g,1072
|
171
|
-
arpakitlib/ar_schedule_uust_api_client_util.py,sha256=
|
171
|
+
arpakitlib/ar_schedule_uust_api_client_util.py,sha256=0Ns0mMEXYEkVmP6YTAXHyNcrhNsvCJ8X-G_5XwILhJ4,6855
|
172
172
|
arpakitlib/ar_settings_util.py,sha256=EFRh5WrB_iaqwxy0rGAtnyGtA6JkNCan-Y_Y6XWb4UY,1583
|
173
173
|
arpakitlib/ar_sleep_util.py,sha256=OaLtRaJQWMkGjfj_mW1RB2P4RaSWsAIH8LUoXqsH0zM,1061
|
174
|
-
arpakitlib/ar_sqlalchemy_model_util.py,sha256=
|
174
|
+
arpakitlib/ar_sqlalchemy_model_util.py,sha256=nKJGN32eg3Gn5kmJwHdVJznPT5TydLsfUfwJGdypdUo,6264
|
175
175
|
arpakitlib/ar_sqlalchemy_util.py,sha256=Hcg1THrDsSR_-8dsY1CG3NWPEv0FqCbkPXFXLtjlSJ0,4207
|
176
176
|
arpakitlib/ar_ssh_runner_util.py,sha256=e9deuUdBW7Eh0Exx2nTBhk57SaOZYaJaSjNk8q6dbJk,6804
|
177
177
|
arpakitlib/ar_str_util.py,sha256=tFoGSDYoGpfdVHWor5Li9pEOFmDFlHkX-Z8iOy1LK7Y,3537
|
178
178
|
arpakitlib/ar_type_util.py,sha256=s0NsTM7mV3HuwyRwyYLdNn7Ep2HbyI4FIr-dd8x0lfI,3734
|
179
179
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
|
180
180
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
181
|
-
arpakitlib-1.7.
|
182
|
-
arpakitlib-1.7.
|
183
|
-
arpakitlib-1.7.
|
184
|
-
arpakitlib-1.7.
|
185
|
-
arpakitlib-1.7.
|
186
|
-
arpakitlib-1.7.
|
181
|
+
arpakitlib-1.7.93.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
182
|
+
arpakitlib-1.7.93.dist-info/METADATA,sha256=pZPltqRitxj6pZ7I8pHAauB5P2sUINz3NUjA8ZGSnBY,2824
|
183
|
+
arpakitlib-1.7.93.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
|
184
|
+
arpakitlib-1.7.93.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
185
|
+
arpakitlib-1.7.93.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
186
|
+
arpakitlib-1.7.93.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|