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