arpakitlib 1.7.247__py3-none-any.whl → 1.7.248__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_base_worker_util.py +10 -10
- arpakitlib/ar_operation_execution_util.py +13 -4
- {arpakitlib-1.7.247.dist-info → arpakitlib-1.7.248.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.247.dist-info → arpakitlib-1.7.248.dist-info}/RECORD +7 -7
- {arpakitlib-1.7.247.dist-info → arpakitlib-1.7.248.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.247.dist-info → arpakitlib-1.7.248.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.247.dist-info → arpakitlib-1.7.248.dist-info}/entry_points.txt +0 -0
@@ -10,7 +10,6 @@ from random import randint
|
|
10
10
|
from typing import Any
|
11
11
|
from uuid import uuid4
|
12
12
|
|
13
|
-
from arpakitlib.ar_datetime_util import now_utc_dt
|
14
13
|
from arpakitlib.ar_enumeration_util import Enumeration
|
15
14
|
from arpakitlib.ar_func_util import is_async_function, is_sync_function
|
16
15
|
from arpakitlib.ar_sleep_util import sync_safe_sleep, async_safe_sleep
|
@@ -22,25 +21,26 @@ class BaseWorker(ABC):
|
|
22
21
|
def __init__(
|
23
22
|
self,
|
24
23
|
*,
|
25
|
-
timeout_after_run=timedelta(seconds=0.3),
|
26
|
-
timeout_after_err_in_run=timedelta(seconds=1),
|
24
|
+
timeout_after_run: timedelta = timedelta(seconds=0.3),
|
25
|
+
timeout_after_err_in_run: timedelta = timedelta(seconds=1),
|
27
26
|
startup_funcs: list[Any] | None = None,
|
28
|
-
worker_name: str | None = None
|
27
|
+
worker_name: str | None = None,
|
28
|
+
**kwargs
|
29
29
|
):
|
30
|
+
self.timeout_after_run = timeout_after_run
|
31
|
+
self.timeout_after_err_in_run = timeout_after_err_in_run
|
30
32
|
if startup_funcs is None:
|
31
33
|
startup_funcs = []
|
32
34
|
self.startup_funcs = startup_funcs
|
33
35
|
if worker_name is None:
|
34
36
|
worker_name = self.__class__.__name__
|
35
37
|
self.worker_name = worker_name
|
36
|
-
self.worker_creation_dt = now_utc_dt()
|
37
38
|
self.worker_id = f"{str(uuid4()).replace('-', '')}_{randint(1000, 99999)}"
|
38
|
-
self.worker_fullname = (
|
39
|
-
f"{self.worker_name}_{self.worker_creation_dt.isoformat()}_{self.worker_id}"
|
40
|
-
)
|
41
39
|
self._logger = logging.getLogger(self.worker_fullname)
|
42
|
-
|
43
|
-
|
40
|
+
|
41
|
+
@property
|
42
|
+
def worker_fullname(self) -> str:
|
43
|
+
return f"{self.worker_name}_{self.worker_id}"
|
44
44
|
|
45
45
|
def sync_run_startup_funcs(self):
|
46
46
|
for startup_func in self.startup_funcs:
|
@@ -141,7 +141,7 @@ def remove_operations(
|
|
141
141
|
|
142
142
|
|
143
143
|
class BaseOperationExecutor:
|
144
|
-
def __init__(self, *, sqlalchemy_db: SQLAlchemyDB):
|
144
|
+
def __init__(self, *, sqlalchemy_db: SQLAlchemyDB, **kwargs):
|
145
145
|
self._logger = logging.getLogger(self.__class__.__name__)
|
146
146
|
self.sql_alchemy_db = sqlalchemy_db
|
147
147
|
|
@@ -314,9 +314,14 @@ class OperationExecutorWorker(BaseWorker):
|
|
314
314
|
sqlalchemy_db: SQLAlchemyDB,
|
315
315
|
operation_executor: BaseOperationExecutor | None = None,
|
316
316
|
filter_operation_types: str | list[str] | None = None,
|
317
|
-
startup_funcs: list[Any] | None = None
|
317
|
+
startup_funcs: list[Any] | None = None,
|
318
|
+
**kwargs
|
318
319
|
):
|
319
|
-
super().__init__(
|
320
|
+
super().__init__(
|
321
|
+
timeout_after_run=timedelta(seconds=0.3),
|
322
|
+
timeout_after_err_in_run=timedelta(seconds=0.3),
|
323
|
+
startup_funcs=startup_funcs,
|
324
|
+
)
|
320
325
|
self.sqlalchemy_db = sqlalchemy_db
|
321
326
|
if operation_executor is None:
|
322
327
|
operation_executor = BaseOperationExecutor(sqlalchemy_db=sqlalchemy_db)
|
@@ -383,7 +388,11 @@ class ScheduledOperationCreatorWorker(BaseWorker):
|
|
383
388
|
scheduled_operations: ScheduledOperation | list[ScheduledOperation] | None = None,
|
384
389
|
startup_funcs: list[Any] | None = None
|
385
390
|
):
|
386
|
-
super().__init__(
|
391
|
+
super().__init__(
|
392
|
+
timeout_after_run=timedelta(seconds=0.3),
|
393
|
+
timeout_after_err_in_run=timedelta(seconds=0.3),
|
394
|
+
startup_funcs=startup_funcs
|
395
|
+
)
|
387
396
|
self.sqlalchemy_db = sqlalchemy_db
|
388
397
|
if scheduled_operations is None:
|
389
398
|
scheduled_operations = []
|
@@ -147,7 +147,7 @@ arpakitlib/ar_arpakit_schedule_uust_api_client_util.py,sha256=P4XdmQyPUwmrSGGad1
|
|
147
147
|
arpakitlib/ar_arpakit_schedule_uust_site_util.py,sha256=8wLct9Gd4MWkXzB6nSmETAwTPLw8lfpWgx0LoWSAOvg,1643
|
148
148
|
arpakitlib/ar_arpakitlib_cli_util.py,sha256=208k_kWc-XHTYqL39k-rYrLcTKFF-3og21PVIsq5b2k,3171
|
149
149
|
arpakitlib/ar_base64_util.py,sha256=aZkg2cZTuAaP2IWeG_LXJ6RO7qhyskVwec-Lks0iM-k,676
|
150
|
-
arpakitlib/ar_base_worker_util.py,sha256=
|
150
|
+
arpakitlib/ar_base_worker_util.py,sha256=oIwJVqn8u3vEX7YlFZBHJYUGoYKhBnrgLDDpA3oId2w,5525
|
151
151
|
arpakitlib/ar_blank_util.py,sha256=6O54Z8NnCg8BXxUVWt-oo1kqzt0836k9KJeJofwmj0g,113
|
152
152
|
arpakitlib/ar_cache_file_util.py,sha256=Fo2pH-Zqm966KWFBHG_pbiySGZvhIFCYqy7k1weRfJ0,3476
|
153
153
|
arpakitlib/ar_class_util.py,sha256=Eb4orGm2EFSaHfmrY2A_Nis5iwFMDKFaz1_nxTnfmnQ,487
|
@@ -193,7 +193,7 @@ arpakitlib/ar_logging_util.py,sha256=V4jypypFG1cj4nXae7JiBnRRfm02OTnZSEermx-wlDY
|
|
193
193
|
arpakitlib/ar_mongodb_util.py,sha256=2ECkTnGAZ92qxioL-fmN6R4yZOSr3bXdXLWTzT1C3vk,4038
|
194
194
|
arpakitlib/ar_need_type_util.py,sha256=GETiREPMEYhch-yU6T--Bdawlbb04Jp1Qy7cOsUlIeA,2228
|
195
195
|
arpakitlib/ar_openai_api_client_util.py,sha256=_XmlApvHFMSyjvZydPa_kASIt9LsFrZmSC7YEzIG8Bg,1806
|
196
|
-
arpakitlib/ar_operation_execution_util.py,sha256=
|
196
|
+
arpakitlib/ar_operation_execution_util.py,sha256=poJ3t6AMuZw87WysMuLH8zqm6PVvzErYqlyQmlzLvAE,17908
|
197
197
|
arpakitlib/ar_parse_command.py,sha256=-s61xcATIsfw1eV_iD3xi-grsitbGzSDoAFc5V0OFy4,3447
|
198
198
|
arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
|
199
199
|
arpakitlib/ar_rat_func_util.py,sha256=xDO3gcmZZ0VsTF5zwqyfrkct8FWcKmyl1KUwfdA1s4k,2009
|
@@ -210,8 +210,8 @@ arpakitlib/ar_str_util.py,sha256=yU5gOwNXUQaH5b_tM5t6fXUn9oUcv5EQbVnq2wXXIpQ,337
|
|
210
210
|
arpakitlib/ar_type_util.py,sha256=9C3ErtUVs0tAUqtK-foFzjJOykfBOntfCz2IogDOgfA,4134
|
211
211
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
|
212
212
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
213
|
-
arpakitlib-1.7.
|
214
|
-
arpakitlib-1.7.
|
215
|
-
arpakitlib-1.7.
|
216
|
-
arpakitlib-1.7.
|
217
|
-
arpakitlib-1.7.
|
213
|
+
arpakitlib-1.7.248.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
214
|
+
arpakitlib-1.7.248.dist-info/METADATA,sha256=OO4Z8OomJykSAoUUqwM4l21BMW1YFGZAkZT780tfDm8,3386
|
215
|
+
arpakitlib-1.7.248.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
216
|
+
arpakitlib-1.7.248.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
217
|
+
arpakitlib-1.7.248.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|