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