##// END OF EJS Templates
process-management: show CPU numbers for processes.
marcink -
r1888:5bc22a65 default
parent child Browse files
Show More
@@ -1,113 +1,117 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>
33 <td>
33 RSS:${h.format_byte_size_binary(mem.rss)}
34 RSS:${h.format_byte_size_binary(mem.rss)}
34 </td>
35 </td>
35 <td>
36 <td>
36 VMS:${h.format_byte_size_binary(mem.vms)}
37 VMS:${h.format_byte_size_binary(mem.vms)}
37 </td>
38 </td>
38 <td>
39 <td>
39 MASTER [children: ${len(children)}]
40 MASTER [children: ${len(children)}]
40 </td>
41 </td>
41 </tr>
42 </tr>
42 % for proc_child in children:
43 % for proc_child in children:
43 <% mem = proc_child.memory_info()%>
44 <% mem = proc_child.memory_info()%>
44 <tr>
45 <tr>
45 <td>
46 <td>
46 <code>
47 <code>
47 | ${proc_child.pid} - ${proc_child.name()}
48 | ${proc_child.pid} - ${proc_child.name()}
48 </code>
49 </code>
49 </td>
50 </td>
50 <td>
51 <td>
51 <a href="#showCommand" onclick="$('#pid'+${proc_child.pid}).toggle();return false"> command </a>
52 <a href="#showCommand" onclick="$('#pid'+${proc_child.pid}).toggle();return false"> command </a>
52 <code id="pid${proc_child.pid}" style="display: none">
53 <code id="pid${proc_child.pid}" style="display: none">
53 ${''.join(proc_child.cmdline())}
54 ${' '.join(proc_child.cmdline())}
54 </code>
55 </code>
55 </td>
56 </td>
56 <td>
57 <td>
58 CPU: ${proc_child.cpu_percent()} %
59 </td>
60 <td>
57 RSS:${h.format_byte_size_binary(mem.rss)}
61 RSS:${h.format_byte_size_binary(mem.rss)}
58 </td>
62 </td>
59 <td>
63 <td>
60 VMS:${h.format_byte_size_binary(mem.vms)}
64 VMS:${h.format_byte_size_binary(mem.vms)}
61 </td>
65 </td>
62 <td>
66 <td>
63 <a href="#restartProcess" onclick="restart(this, ${proc_child.pid});return false">
67 <a href="#restartProcess" onclick="restart(this, ${proc_child.pid});return false">
64 restart
68 restart
65 </a>
69 </a>
66 </td>
70 </td>
67 </tr>
71 </tr>
68 % endfor
72 % endfor
69
73
70 % endif
74 % endif
71 % endfor
75 % endfor
72 </table>
76 </table>
73 </div>
77 </div>
74 </div>
78 </div>
75
79
76
80
77 <script>
81 <script>
78
82
79
83
80 restart = function(elem, pid) {
84 restart = function(elem, pid) {
81
85
82 if ($(elem).hasClass('disabled')){
86 if ($(elem).hasClass('disabled')){
83 return;
87 return;
84 }
88 }
85 $(elem).addClass('disabled');
89 $(elem).addClass('disabled');
86 $(elem).html('processing...');
90 $(elem).html('processing...');
87
91
88 $.ajax({
92 $.ajax({
89 url: pyroutes.url('admin_settings_process_management_signal'),
93 url: pyroutes.url('admin_settings_process_management_signal'),
90 headers: {
94 headers: {
91 "X-CSRF-Token": CSRF_TOKEN,
95 "X-CSRF-Token": CSRF_TOKEN,
92 },
96 },
93 data: JSON.stringify({'pids': [pid]}),
97 data: JSON.stringify({'pids': [pid]}),
94 dataType: 'json',
98 dataType: 'json',
95 type: 'POST',
99 type: 'POST',
96 contentType: "application/json; charset=utf-8",
100 contentType: "application/json; charset=utf-8",
97 success: function (data) {
101 success: function (data) {
98 $(elem).html(data.result);
102 $(elem).html(data.result);
99 $(elem).removeClass('disabled');
103 $(elem).removeClass('disabled');
100 },
104 },
101 failure: function (data) {
105 failure: function (data) {
102 $(elem).text('FAILED TO LOAD RESULT');
106 $(elem).text('FAILED TO LOAD RESULT');
103 $(elem).removeClass('disabled');
107 $(elem).removeClass('disabled');
104 },
108 },
105 error: function (data) {
109 error: function (data) {
106 $(elem).text('FAILED TO LOAD RESULT');
110 $(elem).text('FAILED TO LOAD RESULT');
107 $(elem).removeClass('disabled');
111 $(elem).removeClass('disabled');
108 }
112 }
109 })
113 })
110 }
114 }
111
115
112
116
113 </script>
117 </script>
General Comments 0
You need to be logged in to leave comments. Login now