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