arpakitlib 1.6.53__py3-none-any.whl → 1.6.55__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/ar_fastapi_util.py +22 -15
- {arpakitlib-1.6.53.dist-info → arpakitlib-1.6.55.dist-info}/METADATA +2 -1
- {arpakitlib-1.6.53.dist-info → arpakitlib-1.6.55.dist-info}/RECORD +6 -6
- {arpakitlib-1.6.53.dist-info → arpakitlib-1.6.55.dist-info}/LICENSE +0 -0
- {arpakitlib-1.6.53.dist-info → arpakitlib-1.6.55.dist-info}/NOTICE +0 -0
- {arpakitlib-1.6.53.dist-info → arpakitlib-1.6.55.dist-info}/WHEEL +0 -0
arpakitlib/ar_fastapi_util.py
CHANGED
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
import asyncio
|
6
6
|
import logging
|
7
|
+
import multiprocessing
|
7
8
|
import os.path
|
8
9
|
import pathlib
|
9
10
|
import threading
|
@@ -30,7 +31,6 @@ from arpakitlib.ar_dict_util import combine_dicts
|
|
30
31
|
from arpakitlib.ar_enumeration_util import Enumeration
|
31
32
|
from arpakitlib.ar_json_util import safely_transfer_to_json_str_to_json_obj
|
32
33
|
from arpakitlib.ar_logging_util import setup_normal_logging
|
33
|
-
from arpakitlib.ar_operation_execution_util import ExecuteOperationWorker
|
34
34
|
from arpakitlib.ar_settings_util import SimpleSettings
|
35
35
|
from arpakitlib.ar_sqlalchemy_model_util import StoryLogDBM
|
36
36
|
from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDB
|
@@ -403,26 +403,33 @@ class InitSqlalchemyDBStartupAPIEvent(BaseStartupAPIEvent):
|
|
403
403
|
self.sqlalchemy_db.init()
|
404
404
|
|
405
405
|
|
406
|
-
class
|
407
|
-
|
408
|
-
|
409
|
-
|
406
|
+
class SafeRunWorkerModes(Enumeration):
|
407
|
+
async_task = "async_task"
|
408
|
+
thread = "thread"
|
409
|
+
process = "process"
|
410
410
|
|
411
|
-
def async_on_startup(self, *args, **kwargs):
|
412
|
-
thread = threading.Thread(
|
413
|
-
target=self.worker.sync_safe_run,
|
414
|
-
daemon=True
|
415
|
-
)
|
416
|
-
thread.start()
|
417
411
|
|
418
|
-
|
419
|
-
|
420
|
-
def __init__(self, worker: ExecuteOperationWorker):
|
412
|
+
class SafeRunWorkerStartupAPIEvent(BaseStartupAPIEvent):
|
413
|
+
def __init__(self, worker: BaseWorker, safe_run_mode: str):
|
421
414
|
super().__init__()
|
422
415
|
self.worker = worker
|
416
|
+
self.safe_run_mode = safe_run_mode
|
423
417
|
|
424
418
|
def async_on_startup(self, *args, **kwargs):
|
425
|
-
|
419
|
+
if self.safe_run_mode == SafeRunWorkerModes.async_task:
|
420
|
+
_ = asyncio.create_task(self.worker.async_safe_run())
|
421
|
+
elif self.safe_run_mode == SafeRunWorkerModes.thread:
|
422
|
+
thread = threading.Thread(
|
423
|
+
target=self.worker.sync_safe_run,
|
424
|
+
daemon=True
|
425
|
+
)
|
426
|
+
thread.start()
|
427
|
+
elif self.safe_run_mode == SafeRunWorkerModes.process:
|
428
|
+
process = multiprocessing.Process(
|
429
|
+
target=self.worker.sync_safe_run,
|
430
|
+
daemon=True
|
431
|
+
)
|
432
|
+
process.start()
|
426
433
|
|
427
434
|
|
428
435
|
class BaseTransmittedAPIData(BaseModel):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: arpakitlib
|
3
|
-
Version: 1.6.
|
3
|
+
Version: 1.6.55
|
4
4
|
Summary: arpakitlib
|
5
5
|
Home-page: https://github.com/ARPAKIT-Company/arpakitlib
|
6
6
|
License: Apache-2.0
|
@@ -26,6 +26,7 @@ Requires-Dist: bs4 (>=0.0.2,<0.0.3)
|
|
26
26
|
Requires-Dist: cachetools (>=5.5.0,<6.0.0)
|
27
27
|
Requires-Dist: celery (>=5.4.0,<6.0.0)
|
28
28
|
Requires-Dist: cryptography (>=44.0.0,<45.0.0)
|
29
|
+
Requires-Dist: email-validator (>=2.2.0,<3.0.0)
|
29
30
|
Requires-Dist: fastapi (>=0.115.5,<0.116.0)
|
30
31
|
Requires-Dist: gunicorn (>=23.0.0,<24.0.0)
|
31
32
|
Requires-Dist: itsdangerous (>=2.2.0,<3.0.0)
|
@@ -31,7 +31,7 @@ arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css,sha256=jzPZlgJTFwSdSphk9C
|
|
31
31
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map,sha256=5wq8eXMLU6Zxb45orZPL1zAsBFJReFw6GjYqGpUX3hg,262650
|
32
32
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js,sha256=ffrLZHHEQ_g84A-ul3yWa10Kk09waOAxHcQXPuZuavg,339292
|
33
33
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map,sha256=9UhIW7MqCOZPAz1Sl1IKfZUuhWU0p-LJqrnjjJD9Xhc,1159454
|
34
|
-
arpakitlib/ar_fastapi_util.py,sha256=
|
34
|
+
arpakitlib/ar_fastapi_util.py,sha256=UDPaLaQECwAf_luYxSMC3wsBMebeq7U1I-fzF1g1v08,21458
|
35
35
|
arpakitlib/ar_file_storage_in_dir_util.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
|
36
36
|
arpakitlib/ar_hash_util.py,sha256=Iqy6KBAOLBQMFLWv676boI5sV7atT2B-fb7aCdHOmIQ,340
|
37
37
|
arpakitlib/ar_http_request_util.py,sha256=hMzu2yedUvwIg6gafSakDjXUEC7WH5iplDGiRW9fgPw,3322
|
@@ -59,8 +59,8 @@ arpakitlib/ar_str_util.py,sha256=xSEzmsDvRiZVaxyqFFjcgzpphktCbXg2FHcvsd1DYpA,188
|
|
59
59
|
arpakitlib/ar_type_util.py,sha256=5nDnXL5Oyozlg8XvxMrogsoYiG8_atItg46A0mtv-pk,2025
|
60
60
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=5GMvu8paByni8buhc1vpHB7n6oXe0gPfj1LSvnyZCrQ,5307
|
61
61
|
arpakitlib/ar_zabbix_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
62
|
-
arpakitlib-1.6.
|
63
|
-
arpakitlib-1.6.
|
64
|
-
arpakitlib-1.6.
|
65
|
-
arpakitlib-1.6.
|
66
|
-
arpakitlib-1.6.
|
62
|
+
arpakitlib-1.6.55.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
63
|
+
arpakitlib-1.6.55.dist-info/METADATA,sha256=JeHHhI7nE7PHvDDryE6atRJ-JZxeikL0XjqAC4fY_mk,2749
|
64
|
+
arpakitlib-1.6.55.dist-info/NOTICE,sha256=PxM7bI06pP5flh9MDCUc2LzY3zTeunamwwPihBCLfjU,51
|
65
|
+
arpakitlib-1.6.55.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
66
|
+
arpakitlib-1.6.55.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|