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