##// END OF EJS Templates
process-management: show sum of RSS memory for whole process tree.
marcink -
r1901:7a83865c default
parent child Browse files
Show More
@@ -1,117 +1,126 b''
1 1
2 2 <div id="update_notice" style="display: none; margin: -40px 0px 20px 0px">
3 3 <div>${_('Checking for updates...')}</div>
4 4 </div>
5 5
6 6
7 7 <div class="panel panel-default">
8 8 <div class="panel-heading">
9 9 <h3 class="panel-title">${_('Gunicorn process management')}</h3>
10 10
11 11 </div>
12 12 <div class="panel-body" id="app">
13 13 <h3>List of Gunicorn processes on this machine</h3>
14 14 <table>
15 15 % for proc in c.gunicorn_processes:
16 16 <% mem = proc.memory_info()%>
17 17 <% children = proc.children(recursive=True) %>
18 18 % if children:
19 19
20 20 <tr>
21 21 <td>
22 22 <code>
23 23 ${proc.pid} - ${proc.name()}
24 24 </code>
25 25 </td>
26 26 <td>
27 27 <a href="#showCommand" onclick="$('#pid'+${proc.pid}).toggle();return false"> command </a>
28 28 <code id="pid${proc.pid}" style="display: none">
29 29 ${' '.join(proc.cmdline())}
30 30 </code>
31 31 </td>
32 32 <td></td>
33 33 <td>
34 34 RSS:${h.format_byte_size_binary(mem.rss)}
35 35 </td>
36 36 <td>
37 37 VMS:${h.format_byte_size_binary(mem.vms)}
38 38 </td>
39 39 <td>
40 MASTER [children: ${len(children)}]
40 MASTER
41 41 </td>
42 42 </tr>
43 <% mem_sum = 0 %>
43 44 % for proc_child in children:
44 45 <% mem = proc_child.memory_info()%>
45 46 <tr>
46 47 <td>
47 48 <code>
48 49 | ${proc_child.pid} - ${proc_child.name()}
49 50 </code>
50 51 </td>
51 52 <td>
52 53 <a href="#showCommand" onclick="$('#pid'+${proc_child.pid}).toggle();return false"> command </a>
53 54 <code id="pid${proc_child.pid}" style="display: none">
54 55 ${' '.join(proc_child.cmdline())}
55 56 </code>
56 57 </td>
57 58 <td>
58 59 CPU: ${proc_child.cpu_percent()} %
59 60 </td>
60 61 <td>
61 62 RSS:${h.format_byte_size_binary(mem.rss)}
63 <% mem_sum += mem.rss %>
62 64 </td>
63 65 <td>
64 66 VMS:${h.format_byte_size_binary(mem.vms)}
65 67 </td>
66 68 <td>
67 69 <a href="#restartProcess" onclick="restart(this, ${proc_child.pid});return false">
68 70 restart
69 71 </a>
70 72 </td>
71 73 </tr>
72 74 % endfor
75 <tr>
76 <td colspan="2"><code>| total processes: ${len(children)}</code></td>
77 <td></td>
78 <td><strong>RSS:${h.format_byte_size_binary(mem_sum)}</strong></td>
79 <td></td>
80 </tr>
81 <tr><td> <code> - </code> </td></tr>
73 82
74 83 % endif
75 84 % endfor
76 85 </table>
77 86 </div>
78 87 </div>
79 88
80 89
81 90 <script>
82 91
83 92
84 93 restart = function(elem, pid) {
85 94
86 95 if ($(elem).hasClass('disabled')){
87 96 return;
88 97 }
89 98 $(elem).addClass('disabled');
90 99 $(elem).html('processing...');
91 100
92 101 $.ajax({
93 102 url: pyroutes.url('admin_settings_process_management_signal'),
94 103 headers: {
95 104 "X-CSRF-Token": CSRF_TOKEN,
96 105 },
97 106 data: JSON.stringify({'pids': [pid]}),
98 107 dataType: 'json',
99 108 type: 'POST',
100 109 contentType: "application/json; charset=utf-8",
101 110 success: function (data) {
102 111 $(elem).html(data.result);
103 112 $(elem).removeClass('disabled');
104 113 },
105 114 failure: function (data) {
106 115 $(elem).text('FAILED TO LOAD RESULT');
107 116 $(elem).removeClass('disabled');
108 117 },
109 118 error: function (data) {
110 119 $(elem).text('FAILED TO LOAD RESULT');
111 120 $(elem).removeClass('disabled');
112 121 }
113 122 })
114 123 }
115 124
116 125
117 126 </script>
General Comments 0
You need to be logged in to leave comments. Login now