arpakitlib 1.7.32__py3-none-any.whl → 1.7.34__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/create_api_app.py +14 -13
- arpakitlib/_arpakit_project_template/src/api/event.py +0 -4
- arpakitlib/_arpakit_project_template/src/operation_execution/scheduled_operations.py +5 -4
- arpakitlib/_arpakit_project_template/src/operation_execution/start_create_scheduled_operation_worker.py +16 -0
- arpakitlib/_arpakit_project_template/src/operation_execution/start_operation_executor_for_dev.py +17 -0
- arpakitlib/ar_operation_execution_util.py +14 -0
- {arpakitlib-1.7.32.dist-info → arpakitlib-1.7.34.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.32.dist-info → arpakitlib-1.7.34.dist-info}/RECORD +12 -12
- arpakitlib/_arpakit_project_template/manage/api_start_for_dev_with_reload.py +0 -9
- arpakitlib/_arpakit_project_template/manage/api_start_for_dev_without_reload.py +0 -9
- {arpakitlib-1.7.32.dist-info → arpakitlib-1.7.34.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.32.dist-info → arpakitlib-1.7.34.dist-info}/NOTICE +0 -0
- {arpakitlib-1.7.32.dist-info → arpakitlib-1.7.34.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.32.dist-info → arpakitlib-1.7.34.dist-info}/entry_points.txt +0 -0
@@ -38,21 +38,22 @@ def create_api_app() -> FastAPI:
|
|
38
38
|
async_funcs_after_response=[]
|
39
39
|
)
|
40
40
|
|
41
|
-
startup_api_events = [
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
]
|
41
|
+
startup_api_events = []
|
42
|
+
|
43
|
+
startup_api_events.append(InitFileStoragesInDir(
|
44
|
+
file_storages_in_dir=[
|
45
|
+
get_cached_media_file_storage_in_dir() if settings.media_dirpath is not None else None,
|
46
|
+
get_cached_cache_file_storage_in_dir() if settings.cache_dirpath is not None else None,
|
47
|
+
get_cached_dump_file_storage_in_dir() if settings.dump_dirpath is not None else None
|
48
|
+
]
|
49
|
+
))
|
51
50
|
|
52
51
|
if settings.api_init_sql_db_at_start:
|
53
52
|
raise_for_type(sqlalchemy_db, SQLAlchemyDB)
|
54
53
|
startup_api_events.append(InitSqlalchemyDBStartupAPIEvent(sqlalchemy_db=sqlalchemy_db))
|
55
54
|
|
55
|
+
startup_api_events.append(StartupAPIEvent(transmitted_api_data=transmitted_api_data))
|
56
|
+
|
56
57
|
if settings.api_start_execute_operation_worker:
|
57
58
|
raise_for_type(sqlalchemy_db, SQLAlchemyDB)
|
58
59
|
startup_api_events.append(
|
@@ -82,9 +83,9 @@ def create_api_app() -> FastAPI:
|
|
82
83
|
)
|
83
84
|
)
|
84
85
|
|
85
|
-
shutdown_api_events = [
|
86
|
-
|
87
|
-
|
86
|
+
shutdown_api_events = []
|
87
|
+
|
88
|
+
startup_api_events.append(ShutdownAPIEvent(transmitted_api_data=transmitted_api_data))
|
88
89
|
|
89
90
|
api_app = create_fastapi_app(
|
90
91
|
title=settings.api_title.strip(),
|
@@ -1,10 +1,6 @@
|
|
1
|
-
import logging
|
2
|
-
|
3
1
|
from arpakitlib.ar_fastapi_util import BaseStartupAPIEvent, BaseShutdownAPIEvent
|
4
2
|
from src.api.transmitted_api_data import TransmittedAPIData
|
5
3
|
|
6
|
-
_logger = logging.getLogger(__name__)
|
7
|
-
|
8
4
|
|
9
5
|
class StartupAPIEvent(BaseStartupAPIEvent):
|
10
6
|
def __init__(self, transmitted_api_data: TransmittedAPIData):
|
@@ -1,12 +1,13 @@
|
|
1
|
-
from
|
1
|
+
from datetime import timedelta
|
2
2
|
|
3
|
+
from arpakitlib.ar_operation_execution_util import ScheduledOperation, is_time_func_every_timedelta
|
3
4
|
from arpakitlib.ar_sqlalchemy_model_util import BaseOperationTypes
|
4
5
|
|
5
6
|
ALL_SCHEDULED_OPERATIONS = []
|
6
7
|
|
7
|
-
|
8
|
+
healthcheck_operation = ScheduledOperation(
|
8
9
|
type=BaseOperationTypes.healthcheck_,
|
9
10
|
input_data={},
|
10
|
-
is_time_func=
|
11
|
+
is_time_func=is_time_func_every_timedelta(td=timedelta(seconds=5))
|
11
12
|
)
|
12
|
-
ALL_SCHEDULED_OPERATIONS.append(
|
13
|
+
ALL_SCHEDULED_OPERATIONS.append(healthcheck_operation)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from arpakitlib.ar_operation_execution_util import CreateScheduledOperationWorker
|
2
|
+
from src.core.util import get_cached_sqlalchemy_db, setup_logging
|
3
|
+
from src.operation_execution.scheduled_operations import ALL_SCHEDULED_OPERATIONS
|
4
|
+
|
5
|
+
|
6
|
+
def start_create_scheduled_operation_worker_for_dev():
|
7
|
+
setup_logging()
|
8
|
+
worker = CreateScheduledOperationWorker(
|
9
|
+
sqlalchemy_db=get_cached_sqlalchemy_db(),
|
10
|
+
scheduled_operations=ALL_SCHEDULED_OPERATIONS
|
11
|
+
)
|
12
|
+
worker.sync_safe_run()
|
13
|
+
|
14
|
+
|
15
|
+
if __name__ == '__main__':
|
16
|
+
start_create_scheduled_operation_worker_for_dev()
|
arpakitlib/_arpakit_project_template/src/operation_execution/start_operation_executor_for_dev.py
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
from arpakitlib.ar_operation_execution_util import ExecuteOperationWorker
|
2
|
+
from src.core.util import get_cached_sqlalchemy_db, setup_logging
|
3
|
+
from src.operation_execution.operation_executor import OperationExecutor
|
4
|
+
|
5
|
+
|
6
|
+
def start_operation_executor_for_dev():
|
7
|
+
setup_logging()
|
8
|
+
worker = ExecuteOperationWorker(
|
9
|
+
sqlalchemy_db=get_cached_sqlalchemy_db(),
|
10
|
+
operation_executor=OperationExecutor(sqlalchemy_db=get_cached_sqlalchemy_db()),
|
11
|
+
filter_operation_types=None
|
12
|
+
)
|
13
|
+
worker.sync_safe_run()
|
14
|
+
|
15
|
+
|
16
|
+
if __name__ == '__main__':
|
17
|
+
start_operation_executor_for_dev()
|
@@ -333,6 +333,20 @@ class CreateScheduledOperationWorker(BaseWorker):
|
|
333
333
|
session.refresh(operation_dbm)
|
334
334
|
|
335
335
|
|
336
|
+
def is_time_func_every_timedelta(*, td: timedelta) -> Callable:
|
337
|
+
last_now_utc_dt = now_utc_dt()
|
338
|
+
|
339
|
+
def func() -> bool:
|
340
|
+
nonlocal last_now_utc_dt
|
341
|
+
now_utc_dt_ = now_utc_dt()
|
342
|
+
if (now_utc_dt_ - last_now_utc_dt) >= td:
|
343
|
+
last_now_utc_dt = now_utc_dt_
|
344
|
+
return True
|
345
|
+
return False
|
346
|
+
|
347
|
+
return func
|
348
|
+
|
349
|
+
|
336
350
|
def __example():
|
337
351
|
pass
|
338
352
|
|
@@ -9,8 +9,6 @@ arpakitlib/_arpakit_project_template/README.md,sha256=EEoHPZrJQtLS3fKD3JvoPhkGhj
|
|
9
9
|
arpakitlib/_arpakit_project_template/example.env,sha256=9JQcdFX1ChuOZ1WVIJj89xg71xDnb-TRi8LYGje9TDM,232
|
10
10
|
arpakitlib/_arpakit_project_template/example_pyproject.toml,sha256=wLzoszIWqIC8qwgJD7FH_2UzKVh4PB7gi030zO6aYbA,485
|
11
11
|
arpakitlib/_arpakit_project_template/manage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
arpakitlib/_arpakit_project_template/manage/api_start_for_dev_with_reload.py,sha256=xg2SFemhe8KmmoYvaG8zkFZyonzxdxcHuugjS3i0q0I,151
|
13
|
-
arpakitlib/_arpakit_project_template/manage/api_start_for_dev_without_reload.py,sha256=_7Zf0_Wciui4cHJSmpRXYVU7MakWCafIqek52LbfwSI,152
|
14
12
|
arpakitlib/_arpakit_project_template/manage/docker_ps.sh,sha256=uwm8vHgeuNLCOn0o9hgP_uc-PUkS9FwLyzZh6ItZ3do,15
|
15
13
|
arpakitlib/_arpakit_project_template/manage/docker_ps_a.sh,sha256=nOQejihYlzstg9oROvYwHIsSLt2Sw0DWQEeT3GBaBNs,18
|
16
14
|
arpakitlib/_arpakit_project_template/manage/docker_run_postgres_for_dev.sh,sha256=EKytHfg5nDIen_QZhltfU7fHNJ68cSbM2ab13smKnTk,276
|
@@ -73,8 +71,8 @@ arpakitlib/_arpakit_project_template/src/additional_model/__init__.py,sha256=47D
|
|
73
71
|
arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py,sha256=4KCOvto9Hj5eMYpvfaJChghhR9bkCvKluGGPWrTezoY,134
|
74
72
|
arpakitlib/_arpakit_project_template/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
75
73
|
arpakitlib/_arpakit_project_template/src/api/asgi.py,sha256=a5UBxOyNC8NG3E0ayhiDo3t5tPoB3WtOf2gbZJFWBAA,74
|
76
|
-
arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=
|
77
|
-
arpakitlib/_arpakit_project_template/src/api/event.py,sha256=
|
74
|
+
arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=GiGYR6Co5F1BfIyWK3_qqhcw9TlfsQedv2_YQVqtFnM,4414
|
75
|
+
arpakitlib/_arpakit_project_template/src/api/event.py,sha256=58wCVyVSIe_kydWi44M0Wvp7bTnV8xvO30gMXzjbFYc,750
|
78
76
|
arpakitlib/_arpakit_project_template/src/api/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
79
77
|
arpakitlib/_arpakit_project_template/src/api/router/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
80
78
|
arpakitlib/_arpakit_project_template/src/api/router/v1/main_router.py,sha256=7MnhMwhmkYlbtvhmprXJ8nfs_iOPYBluwhcef5e_EBY,64
|
@@ -94,7 +92,9 @@ arpakitlib/_arpakit_project_template/src/db/sqlalchemy_model.py,sha256=nXtayUkBa
|
|
94
92
|
arpakitlib/_arpakit_project_template/src/db/util.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
95
93
|
arpakitlib/_arpakit_project_template/src/operation_execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
96
94
|
arpakitlib/_arpakit_project_template/src/operation_execution/operation_executor.py,sha256=jAcBicGYq78p4LZe4G3tU1hRxIsODBRoHerhExZab4k,619
|
97
|
-
arpakitlib/_arpakit_project_template/src/operation_execution/scheduled_operations.py,sha256=
|
95
|
+
arpakitlib/_arpakit_project_template/src/operation_execution/scheduled_operations.py,sha256=xJDPt_3Jo5huOerqY5TUi5DB2W9eI8WcPvSbEPFbImc,464
|
96
|
+
arpakitlib/_arpakit_project_template/src/operation_execution/start_create_scheduled_operation_worker.py,sha256=L1TMmGOTPAyTQNxgTMKCJZAQgqxv8bwNipbrrNURw2U,572
|
97
|
+
arpakitlib/_arpakit_project_template/src/operation_execution/start_operation_executor_for_dev.py,sha256=UHGVZi5-jO0J8FDpRkYJS046oRmwtbt3mrJ9vtYT6WE,587
|
98
98
|
arpakitlib/_arpakit_project_template/src/test_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
99
99
|
arpakitlib/_arpakit_project_template/src/test_data/make_test_data_1.py,sha256=3WVPgRsNCIxWpA-6t_Phe-nFULdHPhS1S_DO11XRmqk,80
|
100
100
|
arpakitlib/_arpakit_project_template/src/test_data/make_test_data_2.py,sha256=MVDc71sj5I1muWin50GwrSxMwYtOOSDOtRmeFErHcXs,80
|
@@ -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=
|
154
|
+
arpakitlib/ar_operation_execution_util.py,sha256=eDGVEFYDO3pFyCg7WGUglyBLs6QkHSYNpAmGpT0zqp4,12883
|
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.
|
169
|
-
arpakitlib-1.7.
|
170
|
-
arpakitlib-1.7.
|
171
|
-
arpakitlib-1.7.
|
172
|
-
arpakitlib-1.7.
|
173
|
-
arpakitlib-1.7.
|
168
|
+
arpakitlib-1.7.34.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
169
|
+
arpakitlib-1.7.34.dist-info/METADATA,sha256=hl1Yho6vgorJ4fa-uIME2zxdqGinF3Q3rk2dIubxHAM,2824
|
170
|
+
arpakitlib-1.7.34.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
|
171
|
+
arpakitlib-1.7.34.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
172
|
+
arpakitlib-1.7.34.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
173
|
+
arpakitlib-1.7.34.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|