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