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