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