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