orphan_process_monitor.py
Orphan process monitor.
__all__ = ['OrphanProcessChecker', 'OrphanProcessMonitor']
module-attribute
¶
OrphanProcessChecker
¶
Orphan process checker.
Only work for Linux platform. On Windows platform, is_orphan is always False and there is no need to do this monitoring on Windows.
Source code in solnlib/orphan_process_monitor.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__init__(callback=None)
¶
Initializes OrphanProcessChecker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback |
Callable
|
(optional) Callback for orphan process. |
None
|
Source code in solnlib/orphan_process_monitor.py
34 35 36 37 38 39 40 41 42 43 44 |
|
check_orphan()
¶
Check if the process becomes orphan.
If the process becomes orphan then call callback function to handle properly.
Returns:
Type | Description |
---|---|
bool
|
True for orphan process else False. |
Source code in solnlib/orphan_process_monitor.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
is_orphan()
¶
Check process is orphan.
For windows platform just return False.
Returns:
Type | Description |
---|---|
bool
|
True for orphan process else False. |
Source code in solnlib/orphan_process_monitor.py
46 47 48 49 50 51 52 53 54 55 56 57 |
|
OrphanProcessMonitor
¶
Orphan process monitor.
Check if process become orphan in background thread per interval and call callback if process become orphan.
Source code in solnlib/orphan_process_monitor.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__init__(callback, interval=1)
¶
Initializes OrphanProcessMonitor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback |
Callable
|
Callback for orphan process monitor. |
required |
interval |
int
|
(optional) Interval to monitor. |
1
|
Source code in solnlib/orphan_process_monitor.py
82 83 84 85 86 87 88 89 90 91 92 93 |
|
start()
¶
Start orphan process monitor.
Source code in solnlib/orphan_process_monitor.py
95 96 97 98 99 100 101 102 |
|
stop()
¶
Stop orphan process monitor.
Source code in solnlib/orphan_process_monitor.py
104 105 106 107 108 109 110 |
|