haiway 0.5.1__py3-none-any.whl → 0.5.3__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.
- haiway/context/metrics.py +5 -3
- {haiway-0.5.1.dist-info → haiway-0.5.3.dist-info}/METADATA +7 -7
- {haiway-0.5.1.dist-info → haiway-0.5.3.dist-info}/RECORD +6 -6
- {haiway-0.5.1.dist-info → haiway-0.5.3.dist-info}/WHEEL +1 -1
- {haiway-0.5.1.dist-info → haiway-0.5.3.dist-info}/LICENSE +0 -0
- {haiway-0.5.1.dist-info → haiway-0.5.3.dist-info}/top_level.txt +0 -0
haiway/context/metrics.py
CHANGED
@@ -21,8 +21,8 @@ from haiway.types import MISSING, Missing, not_missing
|
|
21
21
|
from haiway.utils import freeze
|
22
22
|
|
23
23
|
__all__ = [
|
24
|
-
"ScopeMetrics",
|
25
24
|
"MetricsContext",
|
25
|
+
"ScopeMetrics",
|
26
26
|
]
|
27
27
|
|
28
28
|
|
@@ -48,14 +48,14 @@ class ScopeMetrics:
|
|
48
48
|
self._logger: Logger = logger or getLogger(name=scope)
|
49
49
|
self._parent: Self | None = parent if parent else None
|
50
50
|
self._metrics: dict[type[State], State] = {}
|
51
|
-
self._nested:
|
51
|
+
self._nested: list[ScopeMetrics] = []
|
52
52
|
self._timestamp: float = monotonic()
|
53
53
|
self._finished: bool = False
|
54
54
|
self._loop: AbstractEventLoop = get_event_loop()
|
55
55
|
self._completed: Future[float] = self._loop.create_future()
|
56
56
|
|
57
57
|
if parent := parent:
|
58
|
-
parent._nested.
|
58
|
+
parent._nested.append(self)
|
59
59
|
|
60
60
|
freeze(self)
|
61
61
|
|
@@ -378,6 +378,7 @@ class MetricsContext:
|
|
378
378
|
self._token is None and not self._metrics._finished # pyright: ignore[reportPrivateUsage]
|
379
379
|
), "MetricsContext reentrance is not allowed"
|
380
380
|
self._token = MetricsContext._context.set(self._metrics)
|
381
|
+
self._metrics.log(INFO, "Started...")
|
381
382
|
|
382
383
|
def __exit__(
|
383
384
|
self,
|
@@ -391,3 +392,4 @@ class MetricsContext:
|
|
391
392
|
MetricsContext._context.reset(self._token)
|
392
393
|
self._metrics._finish() # pyright: ignore[reportPrivateUsage]
|
393
394
|
self._token = None
|
395
|
+
self._metrics.log(INFO, f"...finished after {self._metrics.time:.2f}s")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: haiway
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.3
|
4
4
|
Summary: Framework for dependency injection and state management within structured concurrency model.
|
5
5
|
Maintainer-email: Kacper Kaliński <kacper.kalinski@miquido.com>
|
6
6
|
License: MIT License
|
@@ -36,12 +36,12 @@ Requires-Python: >=3.12
|
|
36
36
|
Description-Content-Type: text/markdown
|
37
37
|
License-File: LICENSE
|
38
38
|
Provides-Extra: dev
|
39
|
-
Requires-Dist: ruff
|
40
|
-
Requires-Dist: pyright
|
41
|
-
Requires-Dist: bandit
|
42
|
-
Requires-Dist: pytest
|
43
|
-
Requires-Dist: pytest-cov
|
44
|
-
Requires-Dist: pytest-asyncio
|
39
|
+
Requires-Dist: ruff~=0.5.0; extra == "dev"
|
40
|
+
Requires-Dist: pyright~=1.1; extra == "dev"
|
41
|
+
Requires-Dist: bandit~=1.7; extra == "dev"
|
42
|
+
Requires-Dist: pytest~=7.4; extra == "dev"
|
43
|
+
Requires-Dist: pytest-cov~=4.1; extra == "dev"
|
44
|
+
Requires-Dist: pytest-asyncio~=0.23.0; extra == "dev"
|
45
45
|
|
46
46
|
# 🚗 haiway 🚕 🚚 🚙
|
47
47
|
|
@@ -3,7 +3,7 @@ haiway/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
haiway/context/__init__.py,sha256=21Y3zvRo1bHASZD6B_FNkU28k1-g88RdmUyqxvYXJxg,336
|
4
4
|
haiway/context/access.py,sha256=zPQcQBp5XMlNuszbxhtzi-5mNpDLpZ6PT-gVFDBH0dA,14115
|
5
5
|
haiway/context/disposables.py,sha256=DZjnMp-wMfF-em2Wjhbm1MvXubNpuzFBT70BQNIxC7M,2019
|
6
|
-
haiway/context/metrics.py,sha256=
|
6
|
+
haiway/context/metrics.py,sha256=z5p5ItzXhrYoF8lgC8u179oABBy66mPeCEJR_GKmrLg,10882
|
7
7
|
haiway/context/state.py,sha256=GxGwPQTK8FdSprBd83lQbA9veubp0o93_1Yk3gb7HMc,3000
|
8
8
|
haiway/context/tasks.py,sha256=xXtXIUwXOra0EePTdkcEbMOmpWwFcO3hCRfR_IfvAHk,1978
|
9
9
|
haiway/context/types.py,sha256=VvJA7wAPZ3ISpgyThVguioYUXqhHf0XkPfRd0M1ERiQ,142
|
@@ -29,8 +29,8 @@ haiway/utils/logs.py,sha256=oDsc1ZdqKDjlTlctLbDcp9iX98Acr-1tdw-Pyg3DElo,1577
|
|
29
29
|
haiway/utils/mimic.py,sha256=BkVjTVP2TxxC8GChPGyDV6UXVwJmiRiSWeOYZNZFHxs,1828
|
30
30
|
haiway/utils/noop.py,sha256=qgbZlOKWY6_23Zs43OLukK2HagIQKRyR04zrFVm5rWI,344
|
31
31
|
haiway/utils/queue.py,sha256=oQ3GXCJ-PGNtMEr6EPdgqAvYZoj8lAa7Z2drBKBEoBM,2345
|
32
|
-
haiway-0.5.
|
33
|
-
haiway-0.5.
|
34
|
-
haiway-0.5.
|
35
|
-
haiway-0.5.
|
36
|
-
haiway-0.5.
|
32
|
+
haiway-0.5.3.dist-info/LICENSE,sha256=GehQEW_I1pkmxkkj3NEa7rCTQKYBn7vTPabpDYJlRuo,1063
|
33
|
+
haiway-0.5.3.dist-info/METADATA,sha256=EIKsHf3PK90WS36SFw_O25suR9ko6Te59KooRXCQFf8,3860
|
34
|
+
haiway-0.5.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
35
|
+
haiway-0.5.3.dist-info/top_level.txt,sha256=_LdXVLzUzgkvAGQnQJj5kQfoFhpPW6EF4Kj9NapniLg,7
|
36
|
+
haiway-0.5.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|