metrics.py 10.3 KB
Newer Older
1
from enum import Enum
2
from conf import config as conf
3
4

class QType(Enum):
5
    CUSTOM = 0
6
7
8
    SUM_OF_MAX = 1
    MAX_SUM_PER_INT = 2
    AVG_SUM_PER_INT = 3
9
    SUM_PER_NODE = 4
10
    AVG_OF_NODE = 5
11
    MAX_OF_NODE = 6
Azat Khuziyakhmetov's avatar
Azat Khuziyakhmetov committed
12
    SUM_OF_NODE = 7
13
14
15
16
17
18
19
20
21
    LAST_OF_NODE = 8
    PER_DEVICE = 9
    AVG_PER_DEVICE = 10
    MAX_PER_DEVICE = 11
    LAST_OF_DEVICE = 12
    AVG_PER_DEVICE_INT = 13
    MAX_PER_DEVICE_INT = 14
    AVG_PER_PROC_ON_DEVICE_INT = 15
    PROC_SUM_PER_DEVICE_INT = 16
22
23
24
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

class MType(Enum):
    INT = 1
    STR = 2
    FLT = 3

class APInames():
    NODE_NAME = "node_name"

metrics_proc = {
    'cpu_time_user':    {
        "dbname": 'cpu_time_user',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'cpu_time_system':  {
        "dbname": 'cpu_time_system',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'cpu_time_idle':    {
        "dbname": 'cpu_time_idle',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'cpu_time_iowait':  {
        "dbname": 'cpu_time_iowait',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'write_bytes':      {
        "dbname": 'write_bytes',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'write_count':      {
        "dbname": 'write_count',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'read_bytes':       {
        "dbname": 'read_bytes',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'read_count':       {
        "dbname": 'read_count',
        "query": QType.SUM_OF_MAX,
        "type": MType.INT},
    'mem_rss_max':      {
        "dbname": 'memory_rss',
        "query": QType.MAX_SUM_PER_INT,
        "type": MType.INT},
    'mem_rss_avg':      {
        "dbname": 'memory_rss',
        "query": QType.AVG_SUM_PER_INT,
        "type": MType.INT},
    'mem_swap_max':     {
        "dbname": 'memory_swap',
        "query": QType.MAX_SUM_PER_INT,
        "type": MType.INT},
    'mem_vms':          {
        "dbname": 'memory_vms',
        "query": QType.MAX_SUM_PER_INT,
        "type": MType.INT},
    'cpu_usage':        {
        "dbname": 'cpu_usage',
        "query": QType.MAX_SUM_PER_INT,
        "type": MType.INT},
}

metrics_job = {
    "user_name":        {
        "dbname": "user_name",
        "type": MType.STR},
    "used_queue":       {
        "dbname": "used_queue",
        "type": MType.STR},
    "submit_time":      {
        "dbname": "submit_time",
        "type": MType.INT},
    "start_time":       {
        "dbname": "start_time",
        "type": MType.INT},
    "end_time":         {
        "dbname": "end_time",
        "type": MType.INT},
    "run_time":         {
        "dbname": "run_time",
        "type": MType.INT},
    "requested_time":   {
        "dbname": "requested_time",
        "type": MType.INT},
    "requested_cu":     {
        "dbname": "requested_cu",
        "type": MType.INT},
    "num_nodes":        {
        "dbname": "num_nodes",
        "type": MType.INT},
    "alloc_cu": {
        "dbname": "alloc_cu",
        "type": MType.STR},
}

metrics_node = {
    "cpu_model": {
        "dbname": "cpu_model",
122
123
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
124
125
126
        "type": MType.STR},
    "sockets": {
        "dbname": "sockets",
127
128
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
129
130
131
        "type": MType.INT},
    "cores_per_socket": {
        "dbname": "cores_per_socket",
132
133
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
134
135
136
        "type": MType.INT},
    "phys_thr_core": {
        "dbname": "threads_per_core",
137
138
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
139
140
141
        "type": MType.INT},
    "virt_thr_core": {
        "dbname": "threads_per_core",
142
143
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
144
145
146
        "type": MType.INT},
    "main_mem": {
        "dbname": "main_mem",
147
148
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
149
150
151
        "type": MType.INT},
    "alloc_cu": {
        "dbname": "alloc_cu",
152
153
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
154
155
156
157
158
        "type": MType.INT},
    "alloc_mem": {
        "dbname": "alloc_mem",
        "measurement": conf.measurements["node"],
        "query": QType.CUSTOM,
159
160
161
162
163
164
165
166
167
168
        "type": MType.INT},
    "ib_xmit_max": {
        "dbname": "PortXmitData",
        "measurement": conf.measurements["infiniband"],
        "query": QType.MAX_OF_NODE,
        "type": MType.INT},
    "ib_rcv_max": {
        "dbname": "PortRcvData",
        "measurement": conf.measurements["infiniband"],
        "query": QType.MAX_OF_NODE,
169
        "type": MType.INT},
Azat Khuziyakhmetov's avatar
Azat Khuziyakhmetov committed
170
171
172
173
174
175
176
177
178
179
180
181
    "beegfs_write_sum": {
        "dbname": "MiB-wr",
        "type": MType.INT,
        "query": QType.SUM_OF_NODE,
        "measurement": conf.measurements["beegfs"],
    },
    "beegfs_read_sum": {
        "dbname": "MiB-rd",
        "type": MType.INT,
        "query": QType.SUM_OF_NODE,
        "measurement": conf.measurements["beegfs"],
    },
182
}
183
184
185
186
187
188
189
190
191
192
193
194
195
196

metrics_seq = {
    "proc_cpu_usage_sum": {
        "dbname": "cpu_usage",
        "type": MType.FLT,
        "query": QType.SUM_PER_NODE,
        "measurement": conf.measurements["proc"],
    },
    "proc_mem_rss_sum": {
        "dbname": "memory_rss",
        "type": MType.FLT,
        "query": QType.SUM_PER_NODE,
        "measurement": conf.measurements["proc"],
    },
197
198
199
200
201
202
203
204
205
206
207
208
    "proc_write_sum": {
        "dbname": "write_bytes",
        "type": MType.FLT,
        "query": QType.SUM_PER_NODE,
        "measurement": conf.measurements["proc"],
    },
    "proc_read_sum": {
        "dbname": "read_bytes",
        "type": MType.FLT,
        "query": QType.SUM_PER_NODE,
        "measurement": conf.measurements["proc"],
    },
209
210
211
212
213
214
    "node_cpu_usage_avg": {
        "dbname": "usage_user",
        "type": MType.FLT,
        "query": QType.AVG_OF_NODE,
        "measurement": conf.measurements["cpu"],
    },
215
216
217
218
219
220
    "node_cpu_idle_avg": {
        "dbname": "usage_idle",
        "type": MType.FLT,
        "query": QType.AVG_OF_NODE,
        "measurement": conf.measurements["cpu"],
    },
221
222
223
224
225
226
    "node_load_avg": {
        "dbname": "load1",
        "type": MType.FLT,
        "query": QType.AVG_OF_NODE,
        "measurement": conf.measurements["sys"],
    },
227
228
229
230
231
232
    "node_load_max": {
        "dbname": "load1",
        "type": MType.FLT,
        "query": QType.MAX_OF_NODE,
        "measurement": conf.measurements["sys"],
    },
233
234
235
236
237
238
239
240
241
242
243
244
    "node_ib_xmit_max": {
        "dbname": "PortXmitData",
        "type": MType.INT,
        "query": QType.MAX_OF_NODE,
        "measurement": conf.measurements["infiniband"],
    },
    "node_ib_rcv_max": {
        "dbname": "PortRcvData",
        "type": MType.INT,
        "query": QType.MAX_OF_NODE,
        "measurement": conf.measurements["infiniband"],
    },
Azat Khuziyakhmetov's avatar
Azat Khuziyakhmetov committed
245
246
247
248
249
250
251
252
253
254
255
256
    "node_beegfs_write_sum": {
        "dbname": "MiB-wr",
        "type": MType.INT,
        "query": QType.SUM_OF_NODE,
        "measurement": conf.measurements["beegfs"],
    },
    "node_beegfs_read_sum": {
        "dbname": "MiB-rd",
        "type": MType.INT,
        "query": QType.SUM_OF_NODE,
        "measurement": conf.measurements["beegfs"],
    },
257
}
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

metrics_gpu = {
    "gpu_power_limit": {
        "dbname": "power.limit",
        "type": MType.INT,
        "query": QType.LAST_OF_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_memory_total": {
        "dbname": "memory.total",
        "type": MType.INT,
        "query": QType.LAST_OF_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_temperature_max": {
        "dbname": "temperature.gpu",
        "type": MType.INT,
        "query": QType.MAX_PER_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_power_max": {
        "dbname": "power.draw",
        "type": MType.FLT,
        "query": QType.MAX_PER_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_memory_max": {
        "dbname": "memory.used",
        "type": MType.INT,
        "query": QType.MAX_PER_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_utilization_max": {
        "dbname": "utilization.gpu",
292
        "type": MType.FLT,
293
294
295
        "query": QType.MAX_PER_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
296
297
    "gpu_utilization_avg": {
        "dbname": "utilization.gpu",
298
        "type": MType.FLT,
299
300
301
        "query": QType.AVG_PER_DEVICE,
        "measurement": conf.measurements["gpu_node"],
    },
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
    "gpu_memory_avg_seq": {
        "dbname": "memory.used",
        "type": MType.FLT,
        "query": QType.AVG_PER_DEVICE_INT,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_utilization_avg_seq": {
        "dbname": "utilization.gpu",
        "type": MType.FLT,
        "query": QType.AVG_PER_DEVICE_INT,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_temperature_avg_seq": {
        "dbname": "temperature.gpu",
        "type": MType.INT,
        "query": QType.AVG_PER_DEVICE_INT,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_power_avg_seq": {
        "dbname": "power.draw",
        "type": MType.FLT,
        "query": QType.AVG_PER_DEVICE_INT,
        "measurement": conf.measurements["gpu_node"],
    },
    "gpu_cpu_usage_max": {
        "dbname": "cpu_pcpu",
        "type": MType.INT,
        "query": QType.MAX_SUM_PER_INT,
        "measurement": conf.measurements["gpu_proc"],
    },
    "gpu_cpu_mem_max": {
        "dbname": "cpu_rss",
        "type": MType.INT,
        "query": QType.MAX_SUM_PER_INT,
        "measurement": conf.measurements["gpu_proc"],
    },
    "gpu_cpu_usage_sum_seq": {
        "dbname": "cpu_pcpu",
        "type": MType.INT,
        "query": QType.PROC_SUM_PER_DEVICE_INT,
        "measurement": conf.measurements["gpu_proc"],
    },
    "gpu_cpu_mem_sum_seq": {
        "dbname": "cpu_rss",
        "type": MType.INT,
        "query": QType.PROC_SUM_PER_DEVICE_INT,
        "measurement": conf.measurements["gpu_proc"],
    },
    "gpu_cpu_proc_count_total": {
        "dbname": "pid",
        "type": MType.INT,
        "query": QType.CUSTOM,
        "measurement": conf.measurements["gpu_proc"],
    },
    "gpu_cpu_proc_count_sum_seq": {
        "dbname": "pid",
        "type": MType.INT,
        "query": QType.CUSTOM,
        "measurement": conf.measurements["gpu_proc"],
    },

}