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