ut-wdp 1.0.0.20250816__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.
ut_wdp/__init__.py ADDED
File without changes
ut_wdp/__version__.py ADDED
@@ -0,0 +1,26 @@
1
+ """Version module
2
+ Attributes:
3
+ __title__: package title
4
+ __description__: package description
5
+ __url__: project url
6
+ __version__: package version'
7
+ __build__: package build id
8
+ __author__: package author
9
+ __author_email__: email of package author'
10
+ __license__: package license
11
+ __copyright__: package copyright
12
+ __cake__: package cake
13
+ """
14
+ from datetime import datetime
15
+ _now = datetime.now().strftime("%Y%m%d")
16
+
17
+ __title__ = 'ut_wdp'
18
+ __description__ = 'Utilities for Watch Dog Processors.'
19
+ __url__ = 'https://ut-wdp.readthedocs.io/en/latest'
20
+ __version__ = f'1.0.0.{_now}'
21
+ __build__ = _now
22
+ __author__ = 'Bernd Stroehle'
23
+ __author_email__ = 'bernd.stroehle@gmail.com'
24
+ __license__ = 'GPL-3.0-only WITH Classpath-Exception-2.0 OR BSD-3-Clause'
25
+ __copyright__ = 'Copyright 2025 Bernd Stroehle'
26
+ __cake__ = u'\u2728 \U0001f370 \u2728'
File without changes
ut_wdp/pmeh/py.typed ADDED
File without changes
ut_wdp/pmeh/wdp.py ADDED
@@ -0,0 +1,151 @@
1
+ """
2
+ This module provides task scheduling classes for the management of OmniTracker
3
+ SRR (NHRR) processing for Department UMH.
4
+ SRR: Sustainability Risk Rating
5
+ NHRR: Nachhaltigkeits Risiko Rating
6
+ """
7
+ import os
8
+ import glob
9
+ import time
10
+
11
+ from ut_log.log import LogEq, Log
12
+ from ut_dic.dic import Dic
13
+ from ut_path.pathnm import PathNm
14
+ from ut_path.path import Path, AoPath
15
+ from ut_ctl.journalctl import Journalctl
16
+
17
+ from watchdog.observers import Observer
18
+ from watchdog.events import PatternMatchingEventHandler
19
+
20
+ from typing import Any
21
+ TyArr = list[Any]
22
+ TyDic = dict[Any, Any]
23
+ TyStr = str
24
+ TyPath = str
25
+ TyAoPath = list[str]
26
+
27
+ TnPath = None | TyPath
28
+
29
+
30
+ class PmeHandler(PatternMatchingEventHandler):
31
+ """
32
+ WatchDog Event Handler for pattern matching of files paths
33
+ """
34
+ msg_evt: TyStr = "Watchdog received {E} - {P}"
35
+ msg_exe: TyStr = "Watchdog executes script: {S}"
36
+
37
+ def __init__(self, patterns, scripts):
38
+ # Set the patterns for PatternMatchingEventHandler
39
+ # self.kwargs = kwargs
40
+ super().__init__(
41
+ patterns=patterns,
42
+ ignore_patterns=None,
43
+ ignore_directories=True,
44
+ case_sensitive=False)
45
+ self.scripts = scripts
46
+
47
+ def ex(self):
48
+ """
49
+ Process created or modified event
50
+ """
51
+ Log.debug(f"Watchdog executes scripts: {self.scripts}")
52
+ for _script in self.scripts:
53
+ Log.debug(f"Watchdog executes script: {_script}")
54
+ if os.path.exists(_script):
55
+ os.system(_script)
56
+ else:
57
+ Log.error(f"Script {_script} not found")
58
+
59
+ def on_created(self, event):
60
+ """
61
+ Process 'files paths are created' event
62
+ """
63
+ _path = event.src_path
64
+ Log.debug(f"Watchdog received created event = {event} for path = {_path}")
65
+ self.ex()
66
+
67
+ def on_modified(self, event):
68
+ """
69
+ Process 'files paths are modified' event
70
+ """
71
+ _path = event.src_path
72
+ Log.debug(f"Watchdog received modified event = {event} for path = {_path}")
73
+ self.ex()
74
+
75
+
76
+ class WdP:
77
+ """
78
+ Watch Dog Processor
79
+ """
80
+ @staticmethod
81
+ def sh_scripts(kwargs: TyDic) -> TyArr:
82
+ """
83
+ WatchDog Task for pattern matching of files paths
84
+ """
85
+ _scripts: TyArr = Dic.get_as_array(kwargs, 'scripts')
86
+ LogEq.debug("_scripts", _scripts)
87
+
88
+ _scripts_new = []
89
+ for _script in _scripts:
90
+ LogEq.debug("_script", _script)
91
+ _script = Path.sh_path_by_tpl_pac_sep(_script, kwargs)
92
+ LogEq.debug("_script", _script)
93
+ _scripts_new.append(_script)
94
+ LogEq.debug("_scripts_new", _scripts_new)
95
+ return _scripts_new
96
+
97
+ @classmethod
98
+ def sh_a_path_gt_threshold(
99
+ cls, in_dir, in_patterns, kwargs: TyDic) -> TyAoPath:
100
+ """
101
+ WatchDog Task for pattern matching of files paths
102
+ """
103
+ _a_path: TyAoPath = []
104
+ _service_name = kwargs.get('service_name', '')
105
+ # _last_stop_ts = Journalctl.get_last_stop_ts_s(_service_name)
106
+ _last_stop_ts = Journalctl.get_last_stop_ts_s(_service_name)
107
+ Log.debug(f"_last_stop_ts: {_last_stop_ts} for service: {_service_name}")
108
+ if not _last_stop_ts:
109
+ return _a_path
110
+
111
+ for _path in in_patterns:
112
+ _path_new = os.path.join(in_dir, _path)
113
+ _a_path = _a_path + glob.glob(_path_new)
114
+ msg = f"_a_path: {_a_path} for in_dir: {in_dir}, _in_patterns: {in_patterns}"
115
+ Log.debug(msg)
116
+ _a_path = AoPath.sh_aopath_mtime_gt_threshold(_a_path, _last_stop_ts)
117
+ Log.debug(f"_a_path: {_a_path} after selection by threshhold: {_last_stop_ts}")
118
+ return _a_path
119
+
120
+ @classmethod
121
+ def pmeh(cls, kwargs: TyDic) -> None:
122
+ """
123
+ WatchDog Task for pattern matching of files paths
124
+ """
125
+ _in_dir = PathNm.sh_path('in_dir', kwargs)
126
+ _in_patterns: TyArr = Dic.get_as_array(kwargs, 'in_patterns')
127
+ _scripts: TyArr = cls.sh_scripts(kwargs)
128
+
129
+ LogEq.debug("_in_dir", _in_dir)
130
+ LogEq.debug("_in_patterns", _in_patterns)
131
+ LogEq.debug("_scripts", _scripts)
132
+
133
+ _pmehandler = PmeHandler(_in_patterns, _scripts)
134
+
135
+ _sw_ex_gt_threshold = kwargs.get('sw_ex_gt_threshold', False)
136
+ if _sw_ex_gt_threshold:
137
+ _a_path = cls.sh_a_path_gt_threshold(_in_dir, _in_patterns, kwargs)
138
+ if len(_a_path) > 0:
139
+ _pmehandler.ex()
140
+
141
+ _observer = Observer()
142
+ _observer.schedule(_pmehandler, path=_in_dir, recursive=False)
143
+ _observer.start()
144
+
145
+ _sleep: int = kwargs.get('sleep', 1)
146
+ try:
147
+ while True:
148
+ time.sleep(_sleep)
149
+ except KeyboardInterrupt:
150
+ _observer.stop()
151
+ _observer.join()
@@ -0,0 +1,778 @@
1
+ Metadata-Version: 2.4
2
+ Name: ut_wdp
3
+ Version: 1.0.0.20250816
4
+ Summary: Utilities for Watchdog Processors
5
+ Author-email: Bernd Stroehle <bernd.stroehle@gmail.com>
6
+ Maintainer-email: Bernd Stroehle <bernd.stroehle@gmail.com>
7
+ License-Expression: GPL-3.0-only WITH Classpath-exception-2.0 OR BSD-3-Clause
8
+ Project-URL: Source Code, https://github.com/bs2910/ut_wdp/tree/master
9
+ Project-URL: Homepage, https://kosakya.de/
10
+ Project-URL: Documentation, https://ut_wdp.readthedocs.io/en/latest
11
+ Project-URL: Apache-2.0 License, https://apache.org/licenses/LICENSE-2.0
12
+ Project-URL: GPLv3 License, https://www.gnu.org/licenses/gpl-3.0.en.html
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/x-rst
15
+ License-File: LICENSE.txt
16
+ Requires-Dist: ut_ctl>=1.0.0.20250711
17
+ Requires-Dist: ut_dic>=1.0.0.20250715
18
+ Requires-Dist: ut_log>=1.0.0.20250715
19
+ Requires-Dist: ut_path>=1.0.0.20250715
20
+ Requires-Dist: watchdog>=6.0.0
21
+ Dynamic: license-file
22
+
23
+ ######
24
+ ut_wdp
25
+ ######
26
+
27
+ ********
28
+ Overview
29
+ ********
30
+
31
+ .. start short_desc
32
+
33
+ **Watch Dog Processor 'Utilities'**
34
+
35
+ .. end short_desc
36
+
37
+ ************
38
+ Installation
39
+ ************
40
+
41
+ .. start installation
42
+
43
+ Package ``ut_wdp`` can be installed from PyPI.
44
+
45
+ To install with ``pip``:
46
+
47
+ .. code-block:: shell
48
+
49
+ $ python -m pip install ut_wdp
50
+
51
+ .. end installation
52
+
53
+ ***************
54
+ Package logging
55
+ ***************
56
+
57
+ (c.f.: **Appendix**: `Package Logging`)
58
+
59
+ *************
60
+ Package files
61
+ *************
62
+
63
+ Classification
64
+ ==============
65
+
66
+ The Package ``ut_wdp`` consist of the following file types (c.f.: **Appendix**: `Python Terminology`):
67
+
68
+ #. **Special files:**
69
+
70
+ a. *py.typed*
71
+
72
+ #. **Special modules:**
73
+
74
+ a. *__init__.py*
75
+ #. *__version__.py*
76
+
77
+ #. **Sub-packages**
78
+
79
+ a. **pmeh**
80
+
81
+ #. **Special files:**
82
+
83
+ a. *py.typed*
84
+
85
+ #. **Special modules:**
86
+
87
+ a. *__init__.py*
88
+
89
+ #. **Modules**
90
+
91
+ #. modules: wdp.py
92
+
93
+ Sub-package: `pmeh`
94
+ ===================
95
+
96
+ Modules
97
+ -------
98
+
99
+ The Sub-package ``pmeh`` contains the following modules.
100
+
101
+ .. pmeh-Modules-label:
102
+ .. table:: *pmeh Modules*
103
+
104
+ +------+-------------------+
105
+ |Name |Decription |
106
+ +======+===================+
107
+ |wdp.py|Watch Dog Processor|
108
+ +------+-------------------+
109
+
110
+ Module: wdp.py
111
+ --------------
112
+
113
+ The Module ``wdp.py`` contains the following classes:
114
+
115
+ +-------------+------+---------------------------------------------+
116
+ |Name |Type |Description |
117
+ +=============+======+=============================================+
118
+ |CustomHandler|normal|Custom Handler of PatternMatchingEventHandler|
119
+ +-------------+------+---------------------------------------------+
120
+ |WdP |static|Watch Dog Processor |
121
+ +-------------+------+---------------------------------------------+
122
+
123
+ wdp.py Class: CustomHandler
124
+ ---------------------------
125
+
126
+ The class ``CustomHandler`` contains the subsequent methods.
127
+
128
+ CustomHandler Methods
129
+ ^^^^^^^^^^^^^^^^^^^^^
130
+
131
+ .. Methods-of-class-CustomHandler-label:
132
+ .. table:: *Methods of class CustomHandler*
133
+
134
+ +-----------+--------+------------------------------------------------------+
135
+ |Name |Type |Description |
136
+ +===========+========+======================================================+
137
+ |__init__ |instance|Initialise class CustomHandler |
138
+ +-----------+--------+------------------------------------------------------+
139
+ |on_created |instance|Process event 'File. refered by file path is created' |
140
+ +-----------+--------+------------------------------------------------------+
141
+ |on_modified|instance|Process 'File referred by file path is modified' event|
142
+ +-----------+--------+------------------------------------------------------+
143
+
144
+ wdp.py Class: WdP
145
+ -----------------
146
+
147
+ The static class ``WdP`` contains the subsequent methods.
148
+
149
+ WdP Methods
150
+ ^^^^^^^^^^^
151
+
152
+ .. Methods-of-class-WdP-label:
153
+ .. table:: *Methods-of-class-WdP*
154
+
155
+ +----+------+-------------------------------------------------+
156
+ |Name|Type |Description |
157
+ +====+======+=================================================+
158
+ |pmeh|static|WatchDog Task for pattern matching of files paths|
159
+ +----+------+-------------------------------------------------+
160
+
161
+ ########
162
+ Appendix
163
+ ########
164
+
165
+ ***************
166
+ Package Logging
167
+ ***************
168
+
169
+ Description
170
+ ===========
171
+
172
+ Logging use the module **log.py** of the logging package **ut_log**.
173
+ The module supports two Logging types:
174
+
175
+ #. **Standard Logging** (std) or
176
+ #. **User Logging** (usr).
177
+
178
+ The Logging type can be defined by one of the values 'std' or 'usr' of the parameter log_type; 'std' is the default.
179
+ The different Logging types are configured by one of the following configuration files:
180
+
181
+ #. **log.std.yml** or
182
+ #. **log.usr.yml**
183
+
184
+ The configuration files can be stored in different configuration directories (ordered by increased priority):
185
+
186
+ #. <package directory of the log package **ut_log**>/**cfg**,
187
+ #. <package directory of the application package **ui_eviq_srr**>/**cfg**,
188
+ #. <application directory of the application **eviq**>/**cfg**,
189
+
190
+ The active configuration file is the configuration file in the directory with the highest priority.
191
+
192
+ Examples
193
+ ========
194
+
195
+ Site-packages-path = **/appl/eviq/.pyenv/versions/3.11.12/lib/python3.11/site-packages**
196
+ Log-package = **ut_log**
197
+ Application-package = **ui_eviq_srr**
198
+ Application-home-path = **/appl/eviq**
199
+
200
+ .. Examples-of-log-configuration-files-label:
201
+ .. table:: **Examples of log configuration-files**
202
+
203
+ +-----------------------------------------------------------------------------------+
204
+ |Log Configuration |
205
+ +----+-------------------+----------------------------------------------+-----------+
206
+ |Type|Directory Type |Directory |File |
207
+ +====+===================+==============================================+===========+
208
+ |std |Log package |<Site-packages-path>/<Log-package>/cfg |log.std.yml|
209
+ | +-------------------+----------------------------------------------+ |
210
+ | |Application package|<Site-packages-path>/<application-package>/cfg| |
211
+ | +-------------------+----------------------------------------------+ |
212
+ | |Application |<application-home-path>/cfg | |
213
+ +----+-------------------+----------------------------------------------+-----------+
214
+ |usr |Log package |<site-packages-path>/ut_log/cfg |log.usr.yml|
215
+ | +-------------------+----------------------------------------------+ |
216
+ | |Application package|<site-packages-path>/ui_eviq_srr/cfg | |
217
+ | +-------------------+----------------------------------------------+ |
218
+ | |Application |<application-path>/cfg | |
219
+ +----+-------------------+----------------------------------------------+-----------+
220
+
221
+ Log message types
222
+ =================
223
+
224
+ Logging defines log file path names for the following log message types: .
225
+
226
+ #. *debug*
227
+ #. *info*
228
+ #. *warning*
229
+ #. *error*
230
+ #. *critical*
231
+
232
+ Log types and Log directories
233
+ -----------------------------
234
+
235
+ Single or multiple Application log directories can be used for each message type:
236
+
237
+ .. Log-types-and-Log-directories-label:
238
+ .. table:: *Log types and directoriesg*
239
+
240
+ +--------------+---------------+
241
+ |Log type |Log directory |
242
+ +--------+-----+--------+------+
243
+ |long |short|multiple|single|
244
+ +========+=====+========+======+
245
+ |debug |dbqs |dbqs |logs |
246
+ +--------+-----+--------+------+
247
+ |info |infs |infs |logs |
248
+ +--------+-----+--------+------+
249
+ |warning |wrns |wrns |logs |
250
+ +--------+-----+--------+------+
251
+ |error |errs |errs |logs |
252
+ +--------+-----+--------+------+
253
+ |critical|crts |crts |logs |
254
+ +--------+-----+--------+------+
255
+
256
+ Application parameter for logging
257
+ ---------------------------------
258
+
259
+ .. Application-parameter-used-in-log-naming-label:
260
+ .. table:: *Application parameter used in log naming*
261
+
262
+ +-----------------+--------------+-----+------------------+-------+-----------+
263
+ |Name |Decription |Value|Description |Default|Example |
264
+ +=================+==============+=====+==================+=======+===========+
265
+ |appl_data |data directory| | | |/data/eviq |
266
+ +-----------------+--------------+-----+------------------+-------+-----------+
267
+ |tenant |tenant name |UMH | | |UMH |
268
+ +-----------------+--------------+-----+------------------+-------+-----------+
269
+ |package |package name | | | |ui_eviq_srr|
270
+ +-----------------+--------------+-----+------------------+-------+-----------+
271
+ |cmd |command | | | |evupreg |
272
+ +-----------------+--------------+-----+------------------+-------+-----------+
273
+ |log_type |Logging Type |std: |Standard logging |std |std |
274
+ | | +-----+------------------+ | |
275
+ | | |usr: |User Logging | | |
276
+ +-----------------+--------------+-----+------------------+-------+-----------+
277
+ |log_ts_type |Logging |ts: |Sec since 1.1.1970|ts |ts |
278
+ | |timestamp +-----+------------------+ | |
279
+ | |type |dt: |Datetime | | |
280
+ +-----------------+--------------+-----+------------------+-------+-----------+
281
+ |log_sw_single_dir|Use single log|True |use single dir. |True |True |
282
+ | |directory +-----+------------------+ | |
283
+ | | |False|use muliple dir. | | |
284
+ +-----------------+--------------+-----+------------------+-------+-----------+
285
+
286
+ Log files naming
287
+ ----------------
288
+
289
+ Naming Conventions (table format)
290
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
291
+
292
+ .. Naming-conventions-for-logging-file-paths-label:
293
+ .. table:: *Naming conventions for logging file paths*
294
+
295
+ +--------+----------------------------------------------+-------------------+
296
+ |Type |Directory |File |
297
+ +========+==============================================+===================+
298
+ |debug |/<appl_data>/<tenant>/RUN/<package>/<cmd>/debs|debs_<ts>_<pid>.log|
299
+ +--------+----------------------------------------------+-------------------+
300
+ |critical|/<appl_data>/<tenant>/RUN/<package>/<cmd>/logs|crts_<ts>_<pid>.log|
301
+ +--------+----------------------------------------------+-------------------+
302
+ |error |/<appl_data>/<tenant>/RUN/<package>/<cmd>/logs|errs_<ts>_<pid>.log|
303
+ +--------+----------------------------------------------+-------------------+
304
+ |info |/<appl_data>/<tenant>/RUN/<package>/<cmd>/logs|infs_<ts>_<pid>.log|
305
+ +--------+----------------------------------------------+-------------------+
306
+ |warning |/<appl_data>/<tenant>/RUN/<package>/<cmd>/logs|rnsg_<ts>_<pid>.log|
307
+ +--------+----------------------------------------------+-------------------+
308
+
309
+ Naming Conventions (tree format)
310
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
311
+
312
+ ::
313
+
314
+ <appl_data> Application data folder
315
+
316
+ └── <tenant> Application tenant folder
317
+
318
+ └── RUN Applications RUN folder for Application log files
319
+
320
+ └── <package> RUN folder of Application package: <package>
321
+
322
+ └── <cmd> RUN folder of Application command <cmd>
323
+
324
+       ├── debs Application command debug messages folder
325
+ │ │
326
+       │   └── debs_<ts>_<pid>.log debug messages for
327
+       │   run of command <cmd>
328
+       │   with pid <pid> at <ts>
329
+       │
330
+       └── logs Application command log messages folder
331
+
332
+       ├── crts_<ts>_<pid>.log critical messages for
333
+       │ run of command <cmd>
334
+       │ with pid <pid> at <ts>
335
+       ├── errs_<ts>_<pid>.log error messages for
336
+       │ run of command <cmd>
337
+       │ with pid <pid> at <ts>
338
+       ├── infs_<ts>_<pid>.log info messages for
339
+       │ run of command <cmd>
340
+       │ with pid <pid> at <ts>
341
+       └── wrns_<ts>_<pid>.log warning messages for
342
+       run of command <cmd>
343
+       with pid <pid> at <ts>
344
+
345
+ Naming Examples (table format)
346
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
347
+
348
+ .. Naming-conventions-for-logging-file-paths-label:
349
+ .. table:: *Naming conventions for logging file paths*
350
+
351
+ +--------+--------------------------------------------+--------------------------+
352
+ |Type |Directory |File |
353
+ +========+============================================+==========================+
354
+ |debug |/appl/eviq/UMH/RUN/ui_eviq_srr/evdomap/debs/|debs_1750096540_354710.log|
355
+ +--------+--------------------------------------------+--------------------------+
356
+ |critical|/appl/eviq/UMH/RUN/ui_eviq_srr/evdomap/logs/|crts_1749971151_240257.log|
357
+ +--------+ +--------------------------+
358
+ |error | |errs_1749971151_240257.log|
359
+ +--------+ +--------------------------+
360
+ |info | |infs_1750096540_354710.log|
361
+ +--------+ +--------------------------+
362
+ |warning | |wrns_1749971151_240257.log|
363
+ +--------+--------------------------------------------+--------------------------+
364
+
365
+ Naming Examples (tree format)
366
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
367
+
368
+ .. code-block:: text
369
+
370
+ /data/eviq/UMH/RUN/ui_eviq_srr/evdomap Run folder of
371
+ │ of function evdomap
372
+ │ of package ui_eviq_srr
373
+ │ for teanant UMH
374
+ │ of application eviq
375
+
376
+ ├── debs debug folder of Application function: evdomap
377
+ │ │
378
+ │ └── debs_1748609414_314062.log debug messages for run
379
+ │ of function evdomap
380
+ │ using pid: 314062 at: 1748609414
381
+
382
+ └── logs log folder of Application function: evdomap
383
+
384
+ ├── errs_1748609414_314062.log error messages for run
385
+ │ of function evdomap
386
+ │ with pid: 314062 at: 1748609414
387
+ ├── infs_1748609414_314062.log info messages for run
388
+ │ of function evdomap
389
+ │ with pid: 314062 at: 1748609414
390
+ └── wrns_1748609414_314062.log warning messages for run
391
+ of function evdomap
392
+ with pid: 314062 at: 1748609414
393
+
394
+ Configuration files
395
+ ===================
396
+
397
+ log.std.yml (jinja2 yml file)
398
+ -----------------------------
399
+
400
+ Content
401
+ ^^^^^^^
402
+
403
+ .. log.std.yml-label:
404
+ .. code-block:: jinja
405
+
406
+ version: 1
407
+
408
+ disable_existing_loggers: False
409
+
410
+ loggers:
411
+
412
+ # standard logger
413
+ std:
414
+ # level: NOTSET
415
+ level: DEBUG
416
+ handlers:
417
+ - std_debug_console
418
+ - std_debug_file
419
+ - std_info_file
420
+ - std_warning_file
421
+ - std_error_file
422
+ - std_critical_file
423
+
424
+ handlers:
425
+
426
+ std_debug_console:
427
+ class: 'logging.StreamHandler'
428
+ level: DEBUG
429
+ formatter: std_debug
430
+ stream: 'ext://sys.stderr'
431
+
432
+ std_debug_file:
433
+ class: 'logging.FileHandler'
434
+ level: DEBUG
435
+ formatter: std_debug
436
+ filename: '{{dir_run_debs}}/debs_{{ts}}_{{pid}}.log'
437
+ mode: 'a'
438
+ delay: true
439
+
440
+ std_info_file:
441
+ class: 'logging.FileHandler'
442
+ level: INFO
443
+ formatter: std_info
444
+ filename: '{{dir_run_infs}}/infs_{{ts}}_{{pid}}.log'
445
+ mode: 'a'
446
+ delay: true
447
+
448
+ std_warning_file:
449
+ class: 'logging.FileHandler'
450
+ level: WARNING
451
+ formatter: std_warning
452
+ filename: '{{dir_run_wrns}}/wrns_{{ts}}_{{pid}}.log'
453
+ mode: 'a'
454
+ delay: true
455
+
456
+ std_error_file:
457
+ class: 'logging.FileHandler'
458
+ level: ERROR
459
+ formatter: std_error
460
+ filename: '{{dir_run_errs}}/errs_{{ts}}_{{pid}}.log'
461
+ mode: 'a'
462
+ delay: true
463
+
464
+ std_critical_file:
465
+ class: 'logging.FileHandler'
466
+ level: CRITICAL
467
+ formatter: std_critical
468
+ filename: '{{dir_run_crts}}/crts_{{ts}}_{{pid}}.log'
469
+ mode: 'a'
470
+ delay: true
471
+
472
+ std_critical_mail:
473
+ class: 'logging.handlers.SMTPHandler'
474
+ level: CRITICAL
475
+ formatter: std_critical_mail
476
+ mailhost : localhost
477
+ fromaddr: 'monitoring@domain.com'
478
+ toaddrs:
479
+ - 'dev@domain.com'
480
+ - 'qa@domain.com'
481
+ subject: 'Critical error with application name'
482
+
483
+ formatters:
484
+
485
+ std_debug:
486
+ format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
487
+ datefmt: '%Y-%m-%d %H:%M:%S'
488
+ std_info:
489
+ format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
490
+ datefmt: '%Y-%m-%d %H:%M:%S'
491
+ std_warning:
492
+ format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
493
+ datefmt: '%Y-%m-%d %H:%M:%S'
494
+ std_error:
495
+ format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
496
+ datefmt: '%Y-%m-%d %H:%M:%S'
497
+ std_critical:
498
+ format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
499
+ datefmt: '%Y-%m-%d %H:%M:%S'
500
+ std_critical_mail:
501
+ format: '%(asctime)-15s %(levelname)s-%(name)s-%(process)d::%(module)s.%(funcName)s|%(lineno)s:: %(message)s'
502
+ datefmt: '%Y-%m-%d %H:%M:%S'
503
+
504
+ Jinja2-variables
505
+ ^^^^^^^^^^^^^^^^
506
+
507
+ .. log.std.yml-Jinja2-variables-label:
508
+ .. table:: *log.std.yml Jinja2 variables*
509
+
510
+ +------------+-----------------------------+-------------------------------------------+
511
+ |Name |Definition |Example |
512
+ +============+=============================+===========================================+
513
+ |dir_run_debs|debug run directory |/data/eviq/UMH/RUN/ui_eviq_srr/evupreg/debs|
514
+ +------------+-----------------------------+-------------------------------------------+
515
+ |dir_run_infs|info run directory |/data/eviq/UMH/RUN/ui_eviq_srr/evupreg/logs|
516
+ +------------+-----------------------------+ |
517
+ |dir_run_wrns|warning run directory | |
518
+ +------------+-----------------------------+ |
519
+ |dir_run_errs|error run directory | |
520
+ +------------+-----------------------------+ |
521
+ |dir_run_crts|critical error run directory | |
522
+ +------------+-----------------------------+-------------------------------------------+
523
+ |ts |Timestamp since 1970 in [sec]|1749483509 |
524
+ | |if log_ts_type == 'ts' | |
525
+ | +-----------------------------+-------------------------------------------+
526
+ | |Datetime in timezone Europe/ |20250609 17:38:29 GMT+0200 |
527
+ | |Berlin if log_ts_type == 'dt'| |
528
+ +------------+-----------------------------+-------------------------------------------+
529
+ |pid |Process ID |79133 |
530
+ +------------+-----------------------------+-------------------------------------------+
531
+
532
+ ***************
533
+ Python Glossary
534
+ ***************
535
+
536
+ .. _python-modules:
537
+
538
+ Python Modules
539
+ ==============
540
+
541
+ Overview
542
+ --------
543
+
544
+ .. Python-Modules-label:
545
+ .. table:: *Python Modules*
546
+
547
+ +--------------+---------------------------------------------------------+
548
+ |Name |Definition |
549
+ +==============+==========+==============================================+
550
+ |Python modules|Files with suffix ``.py``; they could be empty or contain|
551
+ | |python code; other modules can be imported into a module.|
552
+ +--------------+---------------------------------------------------------+
553
+ |special Python|Modules like ``__init__.py`` or ``main.py`` with special |
554
+ |modules |names and functionality. |
555
+ +--------------+---------------------------------------------------------+
556
+
557
+ .. _python-functions:
558
+
559
+ Python Function
560
+ ===============
561
+
562
+ Overview
563
+ --------
564
+
565
+ .. Python-Function-label:
566
+ .. table:: *Python Function*
567
+
568
+ +---------------+---------------------------------------------------------+
569
+ |Name |Definition |
570
+ +===============+==========+==============================================+
571
+ |Python function|Files with suffix ``.py``; they could be empty or contain|
572
+ | |python code; other modules can be imported into a module.|
573
+ +---------------+---------------------------------------------------------+
574
+ |special Python |Modules like ``__init__.py`` or ``main.py`` with special |
575
+ |modules |names and functionality. |
576
+ +---------------+---------------------------------------------------------+
577
+
578
+ .. _python-packages:
579
+
580
+ Python Packages
581
+ ===============
582
+
583
+ Overview
584
+ --------
585
+
586
+ .. Python Packages-Overview-label:
587
+ .. table:: *Python Packages Overview*
588
+
589
+ +---------------------+---------------------------------------------+
590
+ |Name |Definition |
591
+ +=====================+=============================================+
592
+ |Python package |Python packages are directories that contains|
593
+ | |the special module ``__init__.py`` and other |
594
+ | |modules, sub packages, files or directories. |
595
+ +---------------------+---------------------------------------------+
596
+ |Python sub-package |Python sub-packages are python packages which|
597
+ | |are contained in another python package. |
598
+ +---------------------+---------------------------------------------+
599
+ |Python package |directory contained in a python package. |
600
+ |sub-directory | |
601
+ +---------------------+---------------------------------------------+
602
+ |Python package |Python package sub-directories with a special|
603
+ |special sub-directory|meaning like data or cfg |
604
+ +---------------------+---------------------------------------------+
605
+
606
+ Special python package sub-directories
607
+ --------------------------------------
608
+
609
+ .. Special-python-package-sub-directory-Examples-label:
610
+ .. table:: *Special python package sub-directories*
611
+
612
+ +-------+------------------------------------------+
613
+ |Name |Description |
614
+ +=======+==========================================+
615
+ |bin |Directory for package scripts. |
616
+ +-------+------------------------------------------+
617
+ |cfg |Directory for package configuration files.|
618
+ +-------+------------------------------------------+
619
+ |data |Directory for package data files. |
620
+ +-------+------------------------------------------+
621
+ |service|Directory for systemd service scripts. |
622
+ +-------+------------------------------------------+
623
+
624
+ .. _python-files:
625
+
626
+ Python Files
627
+ ============
628
+
629
+ Overview
630
+ --------
631
+
632
+ .. Python-files-label:
633
+ .. table:: *Python files*
634
+
635
+ +--------------+---------------------------------------------------------+
636
+ |Name |Definition |
637
+ +==============+==========+==============================================+
638
+ |Python modules|Files with suffix ``.py``; they could be empty or contain|
639
+ | |python code; other modules can be imported into a module.|
640
+ +--------------+---------------------------------------------------------+
641
+ |Python package|Files within a python package. |
642
+ |files | |
643
+ +--------------+---------------------------------------------------------+
644
+ |Python dunder |Python modules which are named with leading and trailing |
645
+ |modules |double underscores. |
646
+ +--------------+---------------------------------------------------------+
647
+ |special |Files which are not modules and used as python marker |
648
+ |Python files |files like ``py.typed``. |
649
+ +--------------+---------------------------------------------------------+
650
+ |special Python|Modules like ``__init__.py`` or ``main.py`` with special |
651
+ |modules |names and functionality. |
652
+ +--------------+---------------------------------------------------------+
653
+
654
+ .. _python-special-files:
655
+
656
+ Python Special Files
657
+ --------------------
658
+
659
+ .. Python-special-files-label:
660
+ .. table:: *Python special files*
661
+
662
+ +--------+--------+--------------------------------------------------------------+
663
+ |Name |Type |Description |
664
+ +========+========+==============================================================+
665
+ |py.typed|Type |The ``py.typed`` file is a marker file used in Python packages|
666
+ | |checking|to indicate that the package supports type checking. This is a|
667
+ | |marker |part of the PEP 561 standard, which provides a standardized |
668
+ | |file |way to package and distribute type information in Python. |
669
+ +--------+--------+--------------------------------------------------------------+
670
+
671
+ .. _python-special-modules:
672
+
673
+ Python Special Modules
674
+ ----------------------
675
+
676
+ .. Python-special-modules-label:
677
+ .. table:: *Python special modules*
678
+
679
+ +--------------+-----------+----------------------------------------------------------------+
680
+ |Name |Type |Description |
681
+ +==============+===========+================================================================+
682
+ |__init__.py |Package |The dunder (double underscore) module ``__init__.py`` is used to|
683
+ | |directory |execute initialisation code or mark the directory it contains |
684
+ | |marker |as a package. The Module enforces explicit imports and thus |
685
+ | |file |clear namespace use and call them with the dot notation. |
686
+ +--------------+-----------+----------------------------------------------------------------+
687
+ |__main__.py |entry point|The dunder module ``__main__.py`` serves as package entry point |
688
+ | |for the |point. The module is executed when the package is called by the |
689
+ | |package |interpreter with the command **python -m <package name>**. |
690
+ +--------------+-----------+----------------------------------------------------------------+
691
+ |__version__.py|Version |The dunder module ``__version__.py`` consist of assignment |
692
+ | |file |statements used in Versioning. |
693
+ +--------------+-----------+----------------------------------------------------------------+
694
+
695
+ Python classes
696
+ ==============
697
+
698
+ Overview
699
+ --------
700
+
701
+ .. Python-classes-overview-label:
702
+ .. table:: *Python classes overview*
703
+
704
+ +-------------------+---------------------------------------------------+
705
+ |Name |Description |
706
+ +===================+===================================================+
707
+ |Python class |A class is a container to group related methods and|
708
+ | |variables together, even if no objects are created.|
709
+ | |This helps in organizing code logically. |
710
+ +-------------------+---------------------------------------------------+
711
+ |Python static class|A class which contains only @staticmethod or |
712
+ | |@classmethod methods and no instance-specific |
713
+ | |attributes or methods. |
714
+ +-------------------+---------------------------------------------------+
715
+
716
+ Python methods
717
+ ==============
718
+
719
+ Overview
720
+ --------
721
+
722
+ .. Python-methods-overview-label:
723
+ .. table:: *Python methods overview*
724
+
725
+ +--------------+-------------------------------------------+
726
+ |Name |Description |
727
+ +==============+===========================================+
728
+ |Python method |Python functions defined in python modules.|
729
+ +--------------+-------------------------------------------+
730
+ |Python class |Python functions defined in python classes.|
731
+ |method | |
732
+ +--------------+-------------------------------------------+
733
+ |Python special|Python class methods with special names and|
734
+ |class method |functionalities. |
735
+ +--------------+-------------------------------------------+
736
+
737
+ Python class methods
738
+ --------------------
739
+
740
+ .. Python-class-methods-label:
741
+ .. table:: *Python class methods*
742
+
743
+ +--------------+----------------------------------------------+
744
+ |Name |Description |
745
+ +==============+==============================================+
746
+ |Python no |Python function defined in python classes and |
747
+ |instance |decorated with @classmethod or @staticmethod. |
748
+ |class method |The first parameter conventionally called cls |
749
+ | |is a reference to the current class. |
750
+ +--------------+----------------------------------------------+
751
+ |Python |Python function defined in python classes; the|
752
+ |instance |first parameter conventionally called self is |
753
+ |class method |a reference to the current class object. |
754
+ +--------------+----------------------------------------------+
755
+ |special Python|Python class functions with special names and |
756
+ |class method |functionalities. |
757
+ +--------------+----------------------------------------------+
758
+
759
+ Python special class methods
760
+ ----------------------------
761
+
762
+ .. Python-methods-examples-label:
763
+ .. table:: *Python methods examples*
764
+
765
+ +--------+-----------+--------------------------------------------------------------+
766
+ |Name |Type |Description |
767
+ +========+===========+==============================================================+
768
+ |__init__|class |The special method ``__init__`` is called when an instance |
769
+ | |object |(object) of a class is created; instance attributes can be |
770
+ | |constructor|defined and initalized in the method. The method us a single |
771
+ | |method |parameter conventionally called ``self`` to access the object.|
772
+ +--------+-----------+--------------------------------------------------------------+
773
+
774
+ #################
775
+ Table of Contents
776
+ #################
777
+
778
+ .. contents:: **Table of Content**
@@ -0,0 +1,10 @@
1
+ ut_wdp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ ut_wdp/__version__.py,sha256=1F5SgsDkL0Wsfv--aIg60TX07Musv5-mfJBDUhyopZg,855
3
+ ut_wdp/pmeh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ ut_wdp/pmeh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ ut_wdp/pmeh/wdp.py,sha256=5e4pZ6ULoikpW39xSeXIKROacnzQjnlDMHP60G7-F7I,4821
6
+ ut_wdp-1.0.0.20250816.dist-info/licenses/LICENSE.txt,sha256=J_iuINKTDamw5ae3f9kSe4pHFmUHQAn8FL_bWQfJgcg,850
7
+ ut_wdp-1.0.0.20250816.dist-info/METADATA,sha256=mW2F6YKiGY6lEYfRyl3-F4_vJDIrSHTy1-PovO4XII4,32687
8
+ ut_wdp-1.0.0.20250816.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ ut_wdp-1.0.0.20250816.dist-info/top_level.txt,sha256=8DGyc0kJPvjla4PLttEyuCBMSXkHz3y_18J9ri0ca0k,7
10
+ ut_wdp-1.0.0.20250816.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright (c) 2022 Kosakya, GmbH. All rights reserved.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more detail.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ #
17
+ # Person: Role: Email:
18
+ # Bernd Stroehle Author bernd.stroehle@kosakya.de
19
+ # Maintainer
@@ -0,0 +1 @@
1
+ ut_wdp