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