local_process_memory_consumption
mlte/measurement/memory/local_process_memory_consumption.py
Memory consumption measurement for local training processes.
LocalProcessMemoryConsumption
Bases: ProcessMeasurement
Measure memory consumption for a local training process.
Source code in mlte/measurement/memory/local_process_memory_consumption.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
__call__(pid, poll_interval=1)
Monitor memory consumption of process at pid
until exit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid
|
int
|
The process identifier |
required |
poll_interval
|
int
|
The poll interval, in seconds |
1
|
Returns:
Type | Description |
---|---|
MemoryStatistics
|
The captured statistics |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
__init__(identifier)
Initialize a LocalProcessMemoryConsumption instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier
|
str
|
A unique identifier for the measurement |
required |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
134 135 136 137 138 139 140 |
|
value()
classmethod
Returns the class type object for the Value produced by the Measurement.
Source code in mlte/measurement/memory/local_process_memory_consumption.py
165 166 167 168 |
|
MemoryStatistics
Bases: ValueBase
The MemoryStatistics class encapsulates data and functionality for tracking and updating memory consumption statistics for a running process.
Source code in mlte/measurement/memory/local_process_memory_consumption.py
25 26 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 73 74 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 121 122 123 |
|
avg = avg
instance-attribute
The average memory consumption (KB).
max = max
instance-attribute
The maximum memory consumption (KB).
min = min
instance-attribute
The minimum memory consumption (KB).
__init__(evidence_metadata, avg, min, max)
Initialize a MemoryStatistics instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
evidence_metadata
|
EvidenceMetadata
|
The generating measurement's metadata |
required |
avg
|
int
|
The average memory consumption, in KB |
required |
min
|
int
|
The minimum memory consumption, in KB |
required |
max
|
int
|
The maximum memory consumption, in KB |
required |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
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 |
|
__str__()
Return a string representation of MemoryStatistics.
Source code in mlte/measurement/memory/local_process_memory_consumption.py
85 86 87 88 89 90 91 |
|
average_consumption_less_than(threshold)
classmethod
Construct and invoke a condition for average memory consumption.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
threshold
|
float
|
The threshold value for average consumption, in KB |
required |
Returns:
Type | Description |
---|---|
Condition
|
The Condition that can be used to validate a Value. |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
deserialize(evidence_metadata, data)
staticmethod
Deserialize an MemoryStatistics from a JSON object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
evidence_metadata
|
EvidenceMetadata
|
The generating measurement's metadata |
required |
data
|
Dict[str, Any]
|
The JSON object |
required |
Returns:
Type | Description |
---|---|
MemoryStatistics
|
The deserialized instance |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
max_consumption_less_than(threshold)
classmethod
Construct and invoke a condition for maximum memory consumption.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
threshold
|
int
|
The threshold value for maximum consumption, in KB |
required |
Returns:
Type | Description |
---|---|
Condition
|
The Condition that can be used to validate a Value. |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
serialize()
Serialize an MemoryStatistics to a JSON object.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The JSON object |
Source code in mlte/measurement/memory/local_process_memory_consumption.py
58 59 60 61 62 63 64 |
|