arpakitlib 1.5.25__py3-none-any.whl → 1.5.27__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.py +31 -7
- {arpakitlib-1.5.25.dist-info → arpakitlib-1.5.27.dist-info}/METADATA +1 -1
- {arpakitlib-1.5.25.dist-info → arpakitlib-1.5.27.dist-info}/RECORD +6 -6
- {arpakitlib-1.5.25.dist-info → arpakitlib-1.5.27.dist-info}/LICENSE +0 -0
- {arpakitlib-1.5.25.dist-info → arpakitlib-1.5.27.dist-info}/NOTICE +0 -0
- {arpakitlib-1.5.25.dist-info → arpakitlib-1.5.27.dist-info}/WHEEL +0 -0
arpakitlib/ar_base_worker.py
CHANGED
@@ -20,48 +20,72 @@ class BaseWorker(ABC):
|
|
20
20
|
self.timeout_after_err_in_run: float | None = timedelta(seconds=15).total_seconds()
|
21
21
|
|
22
22
|
def sync_on_startup(self):
|
23
|
-
|
23
|
+
pass
|
24
24
|
|
25
25
|
def sync_run(self):
|
26
26
|
raise NotImplementedError()
|
27
27
|
|
28
28
|
def sync_run_on_error(self, exception: BaseException, kwargs: dict[str, Any]):
|
29
|
-
self._logger.info("sync_run_on_error")
|
30
29
|
self._logger.exception(exception)
|
31
30
|
|
32
|
-
def
|
33
|
-
self._logger.info(f"
|
31
|
+
def sync_safe_run(self):
|
32
|
+
self._logger.info(f"sync_safe_run")
|
33
|
+
|
34
|
+
self._logger.info("sync_on_startup starts")
|
34
35
|
self.sync_on_startup()
|
36
|
+
self._logger.info("sync_on_startup ends")
|
37
|
+
|
35
38
|
while True:
|
39
|
+
|
36
40
|
try:
|
41
|
+
|
42
|
+
self._logger.info("sync_run starts")
|
37
43
|
self.sync_run()
|
44
|
+
self._logger.info("sync_run ends")
|
45
|
+
|
38
46
|
if self.timeout_after_run is not None:
|
39
47
|
safe_sleep(self.timeout_after_run)
|
48
|
+
|
40
49
|
except BaseException as exception:
|
50
|
+
|
51
|
+
self._logger.info("sync_run_on_error starts")
|
41
52
|
self.sync_run_on_error(exception=exception, kwargs={})
|
53
|
+
self._logger.info("sync_run_on_error ends")
|
54
|
+
|
42
55
|
if self.timeout_after_err_in_run is not None:
|
43
56
|
safe_sleep(self.timeout_after_err_in_run)
|
44
57
|
|
45
58
|
async def async_on_startup(self):
|
46
|
-
|
59
|
+
pass
|
47
60
|
|
48
61
|
async def async_run(self):
|
49
62
|
raise NotImplementedError()
|
50
63
|
|
51
64
|
async def async_run_on_error(self, exception: BaseException, kwargs: dict[str, Any]):
|
52
|
-
self._logger.info("async_run_on_error")
|
53
65
|
self._logger.exception(exception)
|
54
66
|
|
55
67
|
async def async_safe_run(self):
|
56
|
-
self._logger.info(f"async_safe_run")
|
68
|
+
self._logger.info(f"async_safe_run starts")
|
69
|
+
|
70
|
+
self._logger.info("async_on_startup starts")
|
57
71
|
await self.async_on_startup()
|
72
|
+
self._logger.info("async_on_startup ends")
|
73
|
+
|
58
74
|
while True:
|
75
|
+
|
59
76
|
try:
|
77
|
+
|
60
78
|
await self.async_run()
|
79
|
+
|
61
80
|
if self.timeout_after_run is not None:
|
62
81
|
await asyncio.sleep(self.timeout_after_run)
|
82
|
+
|
63
83
|
except BaseException as exception:
|
84
|
+
|
85
|
+
self._logger.info("async_run_on_error starts")
|
64
86
|
await self.async_run_on_error(exception=exception, kwargs={})
|
87
|
+
self._logger.info("async_run_on_error ends")
|
88
|
+
|
65
89
|
if self.timeout_after_err_in_run is not None:
|
66
90
|
await asyncio.sleep(self.timeout_after_err_in_run)
|
67
91
|
|
@@ -9,7 +9,7 @@ arpakitlib/ar_arpakit_lib_module_util.py,sha256=YzobxRG8-QJ1L5r_8wBdL668CwXoQRIM
|
|
9
9
|
arpakitlib/ar_arpakit_schedule_uust_api_client.py,sha256=mswH5a7ek-xs-smtTTaRTPPmeoXkrAaoDoi-u6HS0BM,18205
|
10
10
|
arpakitlib/ar_arpakitlib_info.py,sha256=cvgrLnEznmYkCAg1adbY46ATjD6GJd-Yk8PTgOPjpKM,248
|
11
11
|
arpakitlib/ar_base64_util.py,sha256=aZkg2cZTuAaP2IWeG_LXJ6RO7qhyskVwec-Lks0iM-k,676
|
12
|
-
arpakitlib/ar_base_worker.py,sha256=
|
12
|
+
arpakitlib/ar_base_worker.py,sha256=NqZKJIij-7rmisPR2k4pl3nEnWCBpMqcvUDYXYIW1_Q,2849
|
13
13
|
arpakitlib/ar_cache_file.py,sha256=m73_vU6bMjXsIurSPO9VCLcHsiHk8ITFS0LNjfI_8Uw,3471
|
14
14
|
arpakitlib/ar_datetime_util.py,sha256=Xe1NiT9oPQzNSG7RVRkhukhbg4i-hhS5ImmV7sPUc8o,971
|
15
15
|
arpakitlib/ar_dict_util.py,sha256=cF5LQJ6tLqyGoEXfDljMDZrikeZoWPw7CgINHIFGvXM,419
|
@@ -62,8 +62,8 @@ arpakitlib/ar_str_util.py,sha256=xSEzmsDvRiZVaxyqFFjcgzpphktCbXg2FHcvsd1DYpA,188
|
|
62
62
|
arpakitlib/ar_type_util.py,sha256=-h-SCsVl11eVo1u4hy2Asn0IfD5TIxmX3Ndug4AvnPE,1761
|
63
63
|
arpakitlib/ar_yookassa_api_client.py,sha256=HOzhTggH_-BligDyqRg2fwhxYf8ULTnnFZkyn0PNdQM,6449
|
64
64
|
arpakitlib/ar_zabbix_util.py,sha256=MTQbmS0QpNCKNOGONNQHf6j7KTZsKGlIbd5rCH0R0WI,6313
|
65
|
-
arpakitlib-1.5.
|
66
|
-
arpakitlib-1.5.
|
67
|
-
arpakitlib-1.5.
|
68
|
-
arpakitlib-1.5.
|
69
|
-
arpakitlib-1.5.
|
65
|
+
arpakitlib-1.5.27.dist-info/LICENSE,sha256=1jqWIkbnMxDfs_i0SXP5qbV6PHjBr1g8506oW7uPjfg,11347
|
66
|
+
arpakitlib-1.5.27.dist-info/METADATA,sha256=ZJZ7aI5UygBLSoJmcxRN9Ib1Ec1_3Iu9lc7yNJ3CwfA,2323
|
67
|
+
arpakitlib-1.5.27.dist-info/NOTICE,sha256=wHwmiq3wExfFfgMsE5U5TOBP9_l72ocIG82KurEels0,43
|
68
|
+
arpakitlib-1.5.27.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
69
|
+
arpakitlib-1.5.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|