arpakitlib 1.8.177__py3-none-any.whl → 1.8.179__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_safe_func.py +12 -3
- {arpakitlib-1.8.177.dist-info → arpakitlib-1.8.179.dist-info}/METADATA +1 -1
- {arpakitlib-1.8.177.dist-info → arpakitlib-1.8.179.dist-info}/RECORD +6 -6
- {arpakitlib-1.8.177.dist-info → arpakitlib-1.8.179.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.177.dist-info → arpakitlib-1.8.179.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.177.dist-info → arpakitlib-1.8.179.dist-info}/entry_points.txt +0 -0
arpakitlib/ar_safe_func.py
CHANGED
@@ -12,11 +12,20 @@ _ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
|
12
12
|
class SafeFuncResult(BaseModel):
|
13
13
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True, from_attributes=True)
|
14
14
|
|
15
|
-
|
15
|
+
has_exception: bool = False
|
16
16
|
func_result: Any = None
|
17
17
|
exception: Exception | None = None
|
18
18
|
duration: dt.timedelta | None = None
|
19
19
|
|
20
|
+
def simple_dict_for_json(self) -> dict[str, Any]:
|
21
|
+
return {
|
22
|
+
"has_exception": self.has_exception,
|
23
|
+
"func_result": self.func_result,
|
24
|
+
"exception": self.exception,
|
25
|
+
"duration": self.duration,
|
26
|
+
"duration_total_seconds": self.duration.total_seconds() if self.duration is not None else None
|
27
|
+
}
|
28
|
+
|
20
29
|
|
21
30
|
def sync_safely_run_func(*, sync_func, args: tuple | None = None, kwargs: dict | None = None) -> SafeFuncResult:
|
22
31
|
if args is None:
|
@@ -28,13 +37,13 @@ def sync_safely_run_func(*, sync_func, args: tuple | None = None, kwargs: dict |
|
|
28
37
|
res = sync_func(*args, **kwargs)
|
29
38
|
duration = now_utc_dt() - func_start_dt
|
30
39
|
return SafeFuncResult(
|
31
|
-
|
40
|
+
has_exception=False,
|
32
41
|
func_result=res,
|
33
42
|
duration=duration
|
34
43
|
)
|
35
44
|
except Exception as exception:
|
36
45
|
return SafeFuncResult(
|
37
|
-
|
46
|
+
has_exception=True,
|
38
47
|
exception=exception
|
39
48
|
)
|
40
49
|
|
@@ -403,7 +403,7 @@ arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJ
|
|
403
403
|
arpakitlib/ar_rat_func_util.py,sha256=Ca10o3RJwyx_DJLxjTxgHDO6NU3M6CWgUR4bif67OE4,2006
|
404
404
|
arpakitlib/ar_retry_func_util.py,sha256=LB4FJRsu2cssnPw6X8bCEcaGpQsXhkLkgeU37w1t9fU,2250
|
405
405
|
arpakitlib/ar_run_cmd_util.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g,1072
|
406
|
-
arpakitlib/ar_safe_func.py,sha256=
|
406
|
+
arpakitlib/ar_safe_func.py,sha256=r0cnmfFIWnOsJPJXm34pVt6prt5WdhzYzf6hxFSLeRo,1864
|
407
407
|
arpakitlib/ar_schedule_uust_api_client_util.py,sha256=rXI2_3OTaIBgR-GixM1Ti-Ue1f9nOcO3EUpYRqdGpYM,6973
|
408
408
|
arpakitlib/ar_settings_util.py,sha256=Y5wi_cmsjDjfJpM0VJHjbo0NoVPKfypKaD1USowwDtQ,1327
|
409
409
|
arpakitlib/ar_sleep_util.py,sha256=ggaj7ML6QK_ADsHMcyu6GUmUpQ_9B9n-SKYH17h-9lM,1045
|
@@ -412,8 +412,8 @@ arpakitlib/ar_sqlalchemy_util.py,sha256=w_tGPTWIMVjHkTEYo9tVe1sfK_4vvfd3zGATLiYC
|
|
412
412
|
arpakitlib/ar_str_util.py,sha256=2lGpnXDf2h1cBZpVf5i1tX_HCv5iBd6IGnrCw4QWWlY,4350
|
413
413
|
arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
|
414
414
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
|
415
|
-
arpakitlib-1.8.
|
416
|
-
arpakitlib-1.8.
|
417
|
-
arpakitlib-1.8.
|
418
|
-
arpakitlib-1.8.
|
419
|
-
arpakitlib-1.8.
|
415
|
+
arpakitlib-1.8.179.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
416
|
+
arpakitlib-1.8.179.dist-info/METADATA,sha256=RbpZzaT8IYWFqkmJ-USYpa2Yt77uzwbF49qhtilnmbQ,3741
|
417
|
+
arpakitlib-1.8.179.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
418
|
+
arpakitlib-1.8.179.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
419
|
+
arpakitlib-1.8.179.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|