logger-36 2024.15__py3-none-any.whl → 2024.17__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.
- logger_36/__init__.py +54 -32
- logger_36/catalog/config/console_rich.py +58 -37
- logger_36/catalog/handler/console.py +64 -42
- logger_36/catalog/handler/console_rich.py +67 -45
- logger_36/catalog/handler/file.py +67 -45
- logger_36/catalog/handler/generic.py +72 -51
- logger_36/catalog/logging/chronos.py +56 -33
- logger_36/catalog/logging/exception.py +74 -0
- logger_36/catalog/logging/gpu.py +56 -33
- logger_36/catalog/logging/memory.py +66 -39
- logger_36/catalog/logging/system.py +56 -32
- logger_36/config/issue.py +51 -30
- logger_36/config/memory.py +51 -30
- logger_36/config/message.py +51 -30
- logger_36/config/system.py +51 -30
- logger_36/constant/error.py +51 -30
- logger_36/constant/generic.py +51 -30
- logger_36/constant/handler.py +51 -30
- logger_36/constant/issue.py +51 -30
- logger_36/constant/logger.py +51 -30
- logger_36/constant/memory.py +51 -30
- logger_36/constant/message.py +51 -30
- logger_36/constant/record.py +51 -30
- logger_36/constant/system.py +51 -30
- logger_36/instance/logger.py +55 -0
- logger_36/instance/loggers.py +56 -0
- logger_36/main.py +61 -33
- logger_36/task/format/memory.py +52 -30
- logger_36/task/format/message.py +52 -30
- logger_36/task/format/rule.py +51 -30
- logger_36/task/inspection.py +52 -30
- logger_36/task/measure/chronos.py +52 -30
- logger_36/task/measure/memory.py +52 -30
- logger_36/task/storage.py +60 -38
- logger_36/type/{extension.py → handler.py} +59 -37
- logger_36/type/issue.py +52 -30
- logger_36/type/logger.py +70 -51
- logger_36/type/loggers.py +78 -0
- logger_36/version.py +53 -32
- {logger_36-2024.15.dist-info → logger_36-2024.17.dist-info}/METADATA +50 -32
- logger_36-2024.17.dist-info/RECORD +43 -0
- {logger_36-2024.15.dist-info → logger_36-2024.17.dist-info}/WHEEL +1 -1
- logger_36/instance.py +0 -34
- logger_36-2024.15.dist-info/RECORD +0 -40
- {logger_36-2024.15.dist-info → logger_36-2024.17.dist-info}/top_level.txt +0 -0
@@ -1,52 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# modify and/ or redistribute the software under the terms of the CeCILL
|
9
|
-
# license as circulated by CEA, CNRS and INRIA at the following URL
|
10
|
-
# "http://www.cecill.info".
|
11
|
-
#
|
12
|
-
# As a counterpart to the access to the source code and rights to copy,
|
13
|
-
# modify and redistribute granted by the license, users are provided only
|
14
|
-
# with a limited warranty and the software's author, the holder of the
|
15
|
-
# economic rights, and the successive licensors have only limited
|
16
|
-
# liability.
|
17
|
-
#
|
18
|
-
# In this respect, the user's attention is drawn to the risks associated
|
19
|
-
# with loading, using, modifying and/or developing or reproducing the
|
20
|
-
# software by the user in light of its specific status of free software,
|
21
|
-
# that may mean that it is complicated to manipulate, and that also
|
22
|
-
# therefore means that it is reserved for developers and experienced
|
23
|
-
# professionals having in-depth computer knowledge. Users are therefore
|
24
|
-
# encouraged to load and test the software's suitability as regards their
|
25
|
-
# requirements in conditions enabling the security of their systems and/or
|
26
|
-
# data to be ensured and, more generally, to use and operate it in the
|
27
|
-
# same conditions as regards security.
|
28
|
-
#
|
29
|
-
# The fact that you are presently reading this means that you have had
|
30
|
-
# knowledge of the CeCILL license and that you accept its terms.
|
31
|
-
|
32
|
-
import dataclasses as dtcl
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
import dataclasses as d
|
33
8
|
import logging as lggg
|
34
9
|
import typing as h
|
35
10
|
|
36
|
-
from logger_36.catalog.config.console_rich import DATE_TIME_COLOR
|
37
|
-
|
38
11
|
try:
|
12
|
+
from logger_36.catalog.config.console_rich import DATE_TIME_COLOR
|
13
|
+
from logger_36.catalog.handler.console_rich import console_rich_handler_t
|
39
14
|
from rich.console import Console as console_t
|
40
15
|
from rich.console import ConsoleOptions as console_options_t
|
41
16
|
from rich.markup import escape as EscapedForRich
|
42
17
|
from rich.terminal_theme import DEFAULT_TERMINAL_THEME
|
43
18
|
except ModuleNotFoundError:
|
44
|
-
console_t = EscapedForRich = DEFAULT_TERMINAL_THEME = None
|
19
|
+
console_t = console_options_t = EscapedForRich = DEFAULT_TERMINAL_THEME = None
|
45
20
|
|
46
|
-
from logger_36.catalog.handler.console_rich import console_rich_handler_t
|
47
21
|
from logger_36.constant.record import SHOW_W_RULE_ATTR
|
48
22
|
from logger_36.task.format.rule import Rule, RuleAsText
|
49
|
-
from logger_36.type.
|
23
|
+
from logger_36.type.handler import handler_extension_t
|
50
24
|
|
51
25
|
|
52
26
|
class can_show_message_p(h.Protocol):
|
@@ -56,25 +30,25 @@ class can_show_message_p(h.Protocol):
|
|
56
30
|
interface_h = can_show_message_p | h.Callable[[str], None]
|
57
31
|
|
58
32
|
|
59
|
-
@
|
33
|
+
@d.dataclass(slots=True, repr=False, eq=False)
|
60
34
|
class generic_handler_t(lggg.Handler):
|
61
35
|
|
62
|
-
extension: handler_extension_t =
|
63
|
-
console: console_t
|
64
|
-
console_options: console_options_t
|
65
|
-
FormattedLines: h.Callable[..., tuple[str, str | None]] =
|
36
|
+
extension: handler_extension_t = d.field(init=False)
|
37
|
+
console: console_t = None
|
38
|
+
console_options: console_options_t = None
|
39
|
+
FormattedLines: h.Callable[..., tuple[str, str | None]] = d.field(init=False)
|
66
40
|
ShowMessage: h.Callable[[str], None] = lambda _arg: None
|
67
41
|
|
68
|
-
name:
|
69
|
-
level:
|
70
|
-
show_where:
|
71
|
-
show_memory_usage:
|
72
|
-
message_width:
|
73
|
-
formatter:
|
42
|
+
name: d.InitVar[str | None] = None
|
43
|
+
level: d.InitVar[int] = lggg.NOTSET
|
44
|
+
show_where: d.InitVar[bool] = True
|
45
|
+
show_memory_usage: d.InitVar[bool] = False
|
46
|
+
message_width: d.InitVar[int] = -1
|
47
|
+
formatter: d.InitVar[lggg.Formatter | None] = None
|
74
48
|
|
75
|
-
supports_html:
|
76
|
-
rich_kwargs:
|
77
|
-
interface:
|
49
|
+
supports_html: d.InitVar[bool] = False
|
50
|
+
rich_kwargs: d.InitVar[dict[str, h.Any] | None] = None
|
51
|
+
interface: d.InitVar[interface_h | None] = None # Cannot be None actually.
|
78
52
|
|
79
53
|
def __post_init__(
|
80
54
|
self,
|
@@ -159,3 +133,50 @@ class generic_handler_t(lggg.Handler):
|
|
159
133
|
)
|
160
134
|
|
161
135
|
self.ShowMessage(message)
|
136
|
+
|
137
|
+
|
138
|
+
"""
|
139
|
+
COPYRIGHT NOTICE
|
140
|
+
|
141
|
+
This software is governed by the CeCILL license under French law and
|
142
|
+
abiding by the rules of distribution of free software. You can use,
|
143
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
144
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
145
|
+
"http://www.cecill.info".
|
146
|
+
|
147
|
+
As a counterpart to the access to the source code and rights to copy,
|
148
|
+
modify and redistribute granted by the license, users are provided only
|
149
|
+
with a limited warranty and the software's author, the holder of the
|
150
|
+
economic rights, and the successive licensors have only limited
|
151
|
+
liability.
|
152
|
+
|
153
|
+
In this respect, the user's attention is drawn to the risks associated
|
154
|
+
with loading, using, modifying and/or developing or reproducing the
|
155
|
+
software by the user in light of its specific status of free software,
|
156
|
+
that may mean that it is complicated to manipulate, and that also
|
157
|
+
therefore means that it is reserved for developers and experienced
|
158
|
+
professionals having in-depth computer knowledge. Users are therefore
|
159
|
+
encouraged to load and test the software's suitability as regards their
|
160
|
+
requirements in conditions enabling the security of their systems and/or
|
161
|
+
data to be ensured and, more generally, to use and operate it in the
|
162
|
+
same conditions as regards security.
|
163
|
+
|
164
|
+
The fact that you are presently reading this means that you have had
|
165
|
+
knowledge of the CeCILL license and that you accept its terms.
|
166
|
+
|
167
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
168
|
+
|
169
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
170
|
+
member of team Morpheme.
|
171
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
172
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
173
|
+
I3S, and Laboratory iBV.
|
174
|
+
|
175
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
176
|
+
Inria: https://www.inria.fr/en/
|
177
|
+
UniCA: https://univ-cotedazur.eu/
|
178
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
179
|
+
I3S: https://www.i3s.unice.fr/en/
|
180
|
+
iBV: http://ibv.unice.fr/
|
181
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
182
|
+
"""
|
@@ -1,39 +1,62 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# This software is governed by the CeCILL license under French law and
|
7
|
-
# abiding by the rules of distribution of free software. You can use,
|
8
|
-
# modify and/ or redistribute the software under the terms of the CeCILL
|
9
|
-
# license as circulated by CEA, CNRS and INRIA at the following URL
|
10
|
-
# "http://www.cecill.info".
|
11
|
-
#
|
12
|
-
# As a counterpart to the access to the source code and rights to copy,
|
13
|
-
# modify and redistribute granted by the license, users are provided only
|
14
|
-
# with a limited warranty and the software's author, the holder of the
|
15
|
-
# economic rights, and the successive licensors have only limited
|
16
|
-
# liability.
|
17
|
-
#
|
18
|
-
# In this respect, the user's attention is drawn to the risks associated
|
19
|
-
# with loading, using, modifying and/or developing or reproducing the
|
20
|
-
# software by the user in light of its specific status of free software,
|
21
|
-
# that may mean that it is complicated to manipulate, and that also
|
22
|
-
# therefore means that it is reserved for developers and experienced
|
23
|
-
# professionals having in-depth computer knowledge. Users are therefore
|
24
|
-
# encouraged to load and test the software's suitability as regards their
|
25
|
-
# requirements in conditions enabling the security of their systems and/or
|
26
|
-
# data to be ensured and, more generally, to use and operate it in the
|
27
|
-
# same conditions as regards security.
|
28
|
-
#
|
29
|
-
# The fact that you are presently reading this means that you have had
|
30
|
-
# knowledge of the CeCILL license and that you accept its terms.
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
31
6
|
|
32
7
|
from logger_36.constant.logger import HIDE_WHERE_KWARG
|
33
|
-
from logger_36.instance import LOGGER
|
8
|
+
from logger_36.instance.logger import LOGGER
|
34
9
|
from logger_36.task.measure.chronos import ElapsedTime
|
10
|
+
from logger_36.type.logger import logger_t
|
35
11
|
|
36
12
|
|
37
|
-
def LogElapsedTime() -> None:
|
13
|
+
def LogElapsedTime(*, logger: logger_t = LOGGER) -> None:
|
38
14
|
""""""
|
39
|
-
|
15
|
+
logger.info(f"Elapsed Time: {ElapsedTime()}", **HIDE_WHERE_KWARG)
|
16
|
+
|
17
|
+
|
18
|
+
"""
|
19
|
+
COPYRIGHT NOTICE
|
20
|
+
|
21
|
+
This software is governed by the CeCILL license under French law and
|
22
|
+
abiding by the rules of distribution of free software. You can use,
|
23
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
24
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
25
|
+
"http://www.cecill.info".
|
26
|
+
|
27
|
+
As a counterpart to the access to the source code and rights to copy,
|
28
|
+
modify and redistribute granted by the license, users are provided only
|
29
|
+
with a limited warranty and the software's author, the holder of the
|
30
|
+
economic rights, and the successive licensors have only limited
|
31
|
+
liability.
|
32
|
+
|
33
|
+
In this respect, the user's attention is drawn to the risks associated
|
34
|
+
with loading, using, modifying and/or developing or reproducing the
|
35
|
+
software by the user in light of its specific status of free software,
|
36
|
+
that may mean that it is complicated to manipulate, and that also
|
37
|
+
therefore means that it is reserved for developers and experienced
|
38
|
+
professionals having in-depth computer knowledge. Users are therefore
|
39
|
+
encouraged to load and test the software's suitability as regards their
|
40
|
+
requirements in conditions enabling the security of their systems and/or
|
41
|
+
data to be ensured and, more generally, to use and operate it in the
|
42
|
+
same conditions as regards security.
|
43
|
+
|
44
|
+
The fact that you are presently reading this means that you have had
|
45
|
+
knowledge of the CeCILL license and that you accept its terms.
|
46
|
+
|
47
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
48
|
+
|
49
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
50
|
+
member of team Morpheme.
|
51
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
52
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
53
|
+
I3S, and Laboratory iBV.
|
54
|
+
|
55
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
56
|
+
Inria: https://www.inria.fr/en/
|
57
|
+
UniCA: https://univ-cotedazur.eu/
|
58
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
59
|
+
I3S: https://www.i3s.unice.fr/en/
|
60
|
+
iBV: http://ibv.unice.fr/
|
61
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
62
|
+
"""
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
import traceback as tcbk
|
8
|
+
|
9
|
+
from logger_36.instance.logger import LOGGER
|
10
|
+
from logger_36.type.logger import logger_t
|
11
|
+
|
12
|
+
|
13
|
+
def LogException(
|
14
|
+
exception: Exception,
|
15
|
+
/,
|
16
|
+
*,
|
17
|
+
logger: logger_t = LOGGER,
|
18
|
+
should_remove_caller: bool = False,
|
19
|
+
) -> None:
|
20
|
+
""""""
|
21
|
+
lines = tcbk.format_exception(exception)
|
22
|
+
if should_remove_caller:
|
23
|
+
message = "\n".join(lines[:1] + lines[2:])
|
24
|
+
else:
|
25
|
+
formatted = "".join(lines)
|
26
|
+
message = f"{type(exception).__name__}:\n{formatted}"
|
27
|
+
logger.error(message)
|
28
|
+
|
29
|
+
|
30
|
+
"""
|
31
|
+
COPYRIGHT NOTICE
|
32
|
+
|
33
|
+
This software is governed by the CeCILL license under French law and
|
34
|
+
abiding by the rules of distribution of free software. You can use,
|
35
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
36
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
37
|
+
"http://www.cecill.info".
|
38
|
+
|
39
|
+
As a counterpart to the access to the source code and rights to copy,
|
40
|
+
modify and redistribute granted by the license, users are provided only
|
41
|
+
with a limited warranty and the software's author, the holder of the
|
42
|
+
economic rights, and the successive licensors have only limited
|
43
|
+
liability.
|
44
|
+
|
45
|
+
In this respect, the user's attention is drawn to the risks associated
|
46
|
+
with loading, using, modifying and/or developing or reproducing the
|
47
|
+
software by the user in light of its specific status of free software,
|
48
|
+
that may mean that it is complicated to manipulate, and that also
|
49
|
+
therefore means that it is reserved for developers and experienced
|
50
|
+
professionals having in-depth computer knowledge. Users are therefore
|
51
|
+
encouraged to load and test the software's suitability as regards their
|
52
|
+
requirements in conditions enabling the security of their systems and/or
|
53
|
+
data to be ensured and, more generally, to use and operate it in the
|
54
|
+
same conditions as regards security.
|
55
|
+
|
56
|
+
The fact that you are presently reading this means that you have had
|
57
|
+
knowledge of the CeCILL license and that you accept its terms.
|
58
|
+
|
59
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
60
|
+
|
61
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
62
|
+
member of team Morpheme.
|
63
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
64
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
65
|
+
I3S, and Laboratory iBV.
|
66
|
+
|
67
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
68
|
+
Inria: https://www.inria.fr/en/
|
69
|
+
UniCA: https://univ-cotedazur.eu/
|
70
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
71
|
+
I3S: https://www.i3s.unice.fr/en/
|
72
|
+
iBV: http://ibv.unice.fr/
|
73
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
74
|
+
"""
|
logger_36/catalog/logging/gpu.py
CHANGED
@@ -1,39 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# This software is governed by the CeCILL license under French law and
|
7
|
-
# abiding by the rules of distribution of free software. You can use,
|
8
|
-
# modify and/ or redistribute the software under the terms of the CeCILL
|
9
|
-
# license as circulated by CEA, CNRS and INRIA at the following URL
|
10
|
-
# "http://www.cecill.info".
|
11
|
-
#
|
12
|
-
# As a counterpart to the access to the source code and rights to copy,
|
13
|
-
# modify and redistribute granted by the license, users are provided only
|
14
|
-
# with a limited warranty and the software's author, the holder of the
|
15
|
-
# economic rights, and the successive licensors have only limited
|
16
|
-
# liability.
|
17
|
-
#
|
18
|
-
# In this respect, the user's attention is drawn to the risks associated
|
19
|
-
# with loading, using, modifying and/or developing or reproducing the
|
20
|
-
# software by the user in light of its specific status of free software,
|
21
|
-
# that may mean that it is complicated to manipulate, and that also
|
22
|
-
# therefore means that it is reserved for developers and experienced
|
23
|
-
# professionals having in-depth computer knowledge. Users are therefore
|
24
|
-
# encouraged to load and test the software's suitability as regards their
|
25
|
-
# requirements in conditions enabling the security of their systems and/or
|
26
|
-
# data to be ensured and, more generally, to use and operate it in the
|
27
|
-
# same conditions as regards security.
|
28
|
-
#
|
29
|
-
# The fact that you are presently reading this means that you have had
|
30
|
-
# knowledge of the CeCILL license and that you accept its terms.
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
31
6
|
|
32
7
|
import sys as sstm
|
33
8
|
|
34
9
|
from logger_36.constant.error import GPU_LOGGING_ERROR
|
35
10
|
from logger_36.constant.logger import HIDE_WHERE_KWARG
|
36
|
-
from logger_36.instance import LOGGER
|
11
|
+
from logger_36.instance.logger import LOGGER
|
12
|
+
from logger_36.type.logger import logger_t
|
37
13
|
|
38
14
|
try:
|
39
15
|
import tensorflow as tsfl
|
@@ -45,7 +21,7 @@ except ModuleNotFoundError:
|
|
45
21
|
_GPU_LOGGING_ERROR = GPU_LOGGING_ERROR
|
46
22
|
|
47
23
|
|
48
|
-
def LogGPURelatedDetails() -> None:
|
24
|
+
def LogGPURelatedDetails(*, logger: logger_t = LOGGER) -> None:
|
49
25
|
""""""
|
50
26
|
global _GPU_LOGGING_ERROR
|
51
27
|
|
@@ -56,7 +32,7 @@ def LogGPURelatedDetails() -> None:
|
|
56
32
|
return
|
57
33
|
|
58
34
|
system_details = tsfl.sysconfig.get_build_info()
|
59
|
-
|
35
|
+
logger.info(
|
60
36
|
f"GPU-RELATED DETAILS\n"
|
61
37
|
f" GPUs: {tsfl.config.list_physical_devices('GPU')}\n"
|
62
38
|
f" CPUs: {tsfl.config.list_physical_devices('CPU')}\n"
|
@@ -67,3 +43,50 @@ def LogGPURelatedDetails() -> None:
|
|
67
43
|
f" TensorRT: {tsrt.__version__}",
|
68
44
|
**HIDE_WHERE_KWARG,
|
69
45
|
)
|
46
|
+
|
47
|
+
|
48
|
+
"""
|
49
|
+
COPYRIGHT NOTICE
|
50
|
+
|
51
|
+
This software is governed by the CeCILL license under French law and
|
52
|
+
abiding by the rules of distribution of free software. You can use,
|
53
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
54
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
55
|
+
"http://www.cecill.info".
|
56
|
+
|
57
|
+
As a counterpart to the access to the source code and rights to copy,
|
58
|
+
modify and redistribute granted by the license, users are provided only
|
59
|
+
with a limited warranty and the software's author, the holder of the
|
60
|
+
economic rights, and the successive licensors have only limited
|
61
|
+
liability.
|
62
|
+
|
63
|
+
In this respect, the user's attention is drawn to the risks associated
|
64
|
+
with loading, using, modifying and/or developing or reproducing the
|
65
|
+
software by the user in light of its specific status of free software,
|
66
|
+
that may mean that it is complicated to manipulate, and that also
|
67
|
+
therefore means that it is reserved for developers and experienced
|
68
|
+
professionals having in-depth computer knowledge. Users are therefore
|
69
|
+
encouraged to load and test the software's suitability as regards their
|
70
|
+
requirements in conditions enabling the security of their systems and/or
|
71
|
+
data to be ensured and, more generally, to use and operate it in the
|
72
|
+
same conditions as regards security.
|
73
|
+
|
74
|
+
The fact that you are presently reading this means that you have had
|
75
|
+
knowledge of the CeCILL license and that you accept its terms.
|
76
|
+
|
77
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
78
|
+
|
79
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
80
|
+
member of team Morpheme.
|
81
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
82
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
83
|
+
I3S, and Laboratory iBV.
|
84
|
+
|
85
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
86
|
+
Inria: https://www.inria.fr/en/
|
87
|
+
UniCA: https://univ-cotedazur.eu/
|
88
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
89
|
+
I3S: https://www.i3s.unice.fr/en/
|
90
|
+
iBV: http://ibv.unice.fr/
|
91
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
92
|
+
"""
|
@@ -1,40 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# This software is governed by the CeCILL license under French law and
|
7
|
-
# abiding by the rules of distribution of free software. You can use,
|
8
|
-
# modify and/ or redistribute the software under the terms of the CeCILL
|
9
|
-
# license as circulated by CEA, CNRS and INRIA at the following URL
|
10
|
-
# "http://www.cecill.info".
|
11
|
-
#
|
12
|
-
# As a counterpart to the access to the source code and rights to copy,
|
13
|
-
# modify and redistribute granted by the license, users are provided only
|
14
|
-
# with a limited warranty and the software's author, the holder of the
|
15
|
-
# economic rights, and the successive licensors have only limited
|
16
|
-
# liability.
|
17
|
-
#
|
18
|
-
# In this respect, the user's attention is drawn to the risks associated
|
19
|
-
# with loading, using, modifying and/or developing or reproducing the
|
20
|
-
# software by the user in light of its specific status of free software,
|
21
|
-
# that may mean that it is complicated to manipulate, and that also
|
22
|
-
# therefore means that it is reserved for developers and experienced
|
23
|
-
# professionals having in-depth computer knowledge. Users are therefore
|
24
|
-
# encouraged to load and test the software's suitability as regards their
|
25
|
-
# requirements in conditions enabling the security of their systems and/or
|
26
|
-
# data to be ensured and, more generally, to use and operate it in the
|
27
|
-
# same conditions as regards security.
|
28
|
-
#
|
29
|
-
# The fact that you are presently reading this means that you have had
|
30
|
-
# knowledge of the CeCILL license and that you accept its terms.
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
31
6
|
|
32
7
|
from logger_36.config.memory import LENGTH_100, MAX_N_SAMPLES
|
33
8
|
from logger_36.constant.logger import HIDE_WHERE_KWARG
|
34
9
|
from logger_36.constant.memory import storage_units_h
|
35
|
-
from logger_36.instance import LOGGER
|
10
|
+
from logger_36.instance.logger import LOGGER
|
36
11
|
from logger_36.task.format.memory import FormattedUsage, UsageBar
|
37
12
|
from logger_36.task.format.message import FormattedMessage
|
13
|
+
from logger_36.type.logger import logger_t
|
38
14
|
|
39
15
|
|
40
16
|
def LogMemoryUsages(
|
@@ -43,14 +19,15 @@ def LogMemoryUsages(
|
|
43
19
|
decimals: int = None,
|
44
20
|
max_n_samples: int | None = MAX_N_SAMPLES,
|
45
21
|
length_100: int = LENGTH_100,
|
22
|
+
logger: logger_t = LOGGER,
|
46
23
|
) -> None:
|
47
24
|
""""""
|
48
|
-
if not
|
25
|
+
if not logger.any_handler_shows_memory:
|
49
26
|
return
|
50
27
|
|
51
|
-
where_s, usages = zip(*
|
28
|
+
where_s, usages = zip(*logger.memory_usages)
|
52
29
|
|
53
|
-
where, max_usage =
|
30
|
+
where, max_usage = logger.max_memory_usage_full
|
54
31
|
value, unit = FormattedUsage(max_usage, unit=unit, decimals=decimals)
|
55
32
|
title = f"Memory Usage: Max={value}{unit} near {where}\n"
|
56
33
|
|
@@ -88,18 +65,68 @@ def LogMemoryUsages(
|
|
88
65
|
)
|
89
66
|
plot = "\n".join(plot)
|
90
67
|
|
91
|
-
|
68
|
+
logger.info(title + plot, **HIDE_WHERE_KWARG)
|
92
69
|
|
93
70
|
|
94
71
|
def LogMaximumMemoryUsage(
|
95
|
-
*,
|
72
|
+
*,
|
73
|
+
unit: storage_units_h | None = "a",
|
74
|
+
decimals: int = None,
|
75
|
+
logger: logger_t = LOGGER,
|
96
76
|
) -> None:
|
97
77
|
"""
|
98
78
|
unit: b or None=bytes, k=kilo, m=mega, g=giga, a=auto
|
99
79
|
"""
|
100
|
-
if
|
101
|
-
where, max_usage =
|
80
|
+
if logger.any_handler_shows_memory:
|
81
|
+
where, max_usage = logger.max_memory_usage_full
|
102
82
|
value, unit = FormattedUsage(max_usage, unit=unit, decimals=decimals)
|
103
|
-
|
83
|
+
logger.info(
|
104
84
|
f"Max. Memory Usage: {value}{unit} near {where}", **HIDE_WHERE_KWARG
|
105
85
|
)
|
86
|
+
|
87
|
+
|
88
|
+
"""
|
89
|
+
COPYRIGHT NOTICE
|
90
|
+
|
91
|
+
This software is governed by the CeCILL license under French law and
|
92
|
+
abiding by the rules of distribution of free software. You can use,
|
93
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
94
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
95
|
+
"http://www.cecill.info".
|
96
|
+
|
97
|
+
As a counterpart to the access to the source code and rights to copy,
|
98
|
+
modify and redistribute granted by the license, users are provided only
|
99
|
+
with a limited warranty and the software's author, the holder of the
|
100
|
+
economic rights, and the successive licensors have only limited
|
101
|
+
liability.
|
102
|
+
|
103
|
+
In this respect, the user's attention is drawn to the risks associated
|
104
|
+
with loading, using, modifying and/or developing or reproducing the
|
105
|
+
software by the user in light of its specific status of free software,
|
106
|
+
that may mean that it is complicated to manipulate, and that also
|
107
|
+
therefore means that it is reserved for developers and experienced
|
108
|
+
professionals having in-depth computer knowledge. Users are therefore
|
109
|
+
encouraged to load and test the software's suitability as regards their
|
110
|
+
requirements in conditions enabling the security of their systems and/or
|
111
|
+
data to be ensured and, more generally, to use and operate it in the
|
112
|
+
same conditions as regards security.
|
113
|
+
|
114
|
+
The fact that you are presently reading this means that you have had
|
115
|
+
knowledge of the CeCILL license and that you accept its terms.
|
116
|
+
|
117
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
118
|
+
|
119
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
120
|
+
member of team Morpheme.
|
121
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
122
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
123
|
+
I3S, and Laboratory iBV.
|
124
|
+
|
125
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
126
|
+
Inria: https://www.inria.fr/en/
|
127
|
+
UniCA: https://univ-cotedazur.eu/
|
128
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
129
|
+
I3S: https://www.i3s.unice.fr/en/
|
130
|
+
iBV: http://ibv.unice.fr/
|
131
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
132
|
+
"""
|