@@ 296-318 (lines=23) @@ | ||
293 | return 'INFO' |
|
294 | ||
295 | ||
296 | def sort_vm_stats(stats: list[dict[str, Any]]) -> tuple[str, list[dict[str, Any]]]: |
|
297 | # Make VM sort related to process sort |
|
298 | if glances_processes.sort_key == 'memory_percent': |
|
299 | sort_by = 'memory_usage' |
|
300 | sort_by_secondary = 'load_1min' |
|
301 | elif glances_processes.sort_key == 'name': |
|
302 | sort_by = 'name' |
|
303 | sort_by_secondary = 'load_1min' |
|
304 | else: |
|
305 | sort_by = 'load_1min' |
|
306 | sort_by_secondary = 'memory_usage' |
|
307 | ||
308 | # Sort vm stats |
|
309 | sort_stats_processes( |
|
310 | stats, |
|
311 | sorted_by=sort_by, |
|
312 | sorted_by_secondary=sort_by_secondary, |
|
313 | # Reverse for all but name |
|
314 | reverse=glances_processes.sort_key != 'name', |
|
315 | ) |
|
316 | ||
317 | # Return the main sort key and the sorted stats |
|
318 | return sort_by, stats |
|
319 |
@@ 551-573 (lines=23) @@ | ||
548 | return 'INFO' |
|
549 | ||
550 | ||
551 | def sort_docker_stats(stats: list[dict[str, Any]]) -> tuple[str, list[dict[str, Any]]]: |
|
552 | # Make VM sort related to process sort |
|
553 | if glances_processes.sort_key == 'memory_percent': |
|
554 | sort_by = 'memory_usage' |
|
555 | sort_by_secondary = 'cpu_percent' |
|
556 | elif glances_processes.sort_key == 'name': |
|
557 | sort_by = 'name' |
|
558 | sort_by_secondary = 'cpu_percent' |
|
559 | else: |
|
560 | sort_by = 'cpu_percent' |
|
561 | sort_by_secondary = 'memory_usage' |
|
562 | ||
563 | # Sort docker stats |
|
564 | sort_stats_processes( |
|
565 | stats, |
|
566 | sorted_by=sort_by, |
|
567 | sorted_by_secondary=sort_by_secondary, |
|
568 | # Reverse for all but name |
|
569 | reverse=glances_processes.sort_key != 'name', |
|
570 | ) |
|
571 | ||
572 | # Return the main sort key and the sorted stats |
|
573 | return sort_by, stats |
|
574 |