diff --git a/rhodecode/apps/admin/__init__.py b/rhodecode/apps/admin/__init__.py --- a/rhodecode/apps/admin/__init__.py +++ b/rhodecode/apps/admin/__init__.py @@ -70,6 +70,9 @@ def admin_routes(config): name='admin_settings_process_management', pattern='/settings/process_management') config.add_route( + name='admin_settings_process_management_data', + pattern='/settings/process_management/data') + config.add_route( name='admin_settings_process_management_signal', pattern='/settings/process_management/signal') diff --git a/rhodecode/apps/admin/views/process_management.py b/rhodecode/apps/admin/views/process_management.py --- a/rhodecode/apps/admin/views/process_management.py +++ b/rhodecode/apps/admin/views/process_management.py @@ -55,6 +55,18 @@ class AdminProcessManagementView(BaseApp @LoginRequired() @HasPermissionAllDecorator('hg.admin') + @view_config( + route_name='admin_settings_process_management_data', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings_process_management_data.mako') + def process_management_data(self): + _ = self.request.translate + c = self.load_default_context() + c.gunicorn_processes = ( + p for p in psutil.process_iter() if 'gunicorn' in p.name()) + return self._get_template_context(c) + + @LoginRequired() + @HasPermissionAllDecorator('hg.admin') @CSRFRequired() @view_config( route_name='admin_settings_process_management_signal', diff --git a/rhodecode/public/js/rhodecode/routes.js b/rhodecode/public/js/rhodecode/routes.js --- a/rhodecode/public/js/rhodecode/routes.js +++ b/rhodecode/public/js/rhodecode/routes.js @@ -48,6 +48,7 @@ function registerRCRoutes() { pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []); pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []); pyroutes.register('admin_settings_process_management', '/_admin/settings/process_management', []); + pyroutes.register('admin_settings_process_management_data', '/_admin/settings/process_management/data', []); pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []); pyroutes.register('admin_defaults_repositories', '/_admin/defaults/repositories', []); pyroutes.register('admin_defaults_repositories_update', '/_admin/defaults/repositories/update', []); @@ -283,6 +284,7 @@ function registerRCRoutes() { pyroutes.register('my_account_ssh_keys_generate', '/_admin/my_account/ssh_keys/generate', []); pyroutes.register('my_account_ssh_keys_add', '/_admin/my_account/ssh_keys/new', []); pyroutes.register('my_account_ssh_keys_delete', '/_admin/my_account/ssh_keys/delete', []); + pyroutes.register('my_account_user_group_membership', '/_admin/my_account/user_group_membership', []); pyroutes.register('my_account_emails', '/_admin/my_account/emails', []); pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []); pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []); diff --git a/rhodecode/templates/admin/settings/settings_process_management.mako b/rhodecode/templates/admin/settings/settings_process_management.mako --- a/rhodecode/templates/admin/settings/settings_process_management.mako +++ b/rhodecode/templates/admin/settings/settings_process_management.mako @@ -7,7 +7,10 @@

${_('Gunicorn process management')}

- +

List of Gunicorn processes on this machine

@@ -20,88 +23,10 @@ return 'RhodeCode' return proc.name() %> - - % for proc in c.gunicorn_processes: - <% mem = proc.memory_info()%> - <% children = proc.children(recursive=True) %> - % if children: - - - - - - - - - - - <% mem_sum = 0 %> - % for proc_child in children: - <% mem = proc_child.memory_info()%> - - - - - - - - - - % endfor - - - - - - - - - % endif - % endfor -
- - ${proc.pid} - ${get_name(proc)} - - - command - - - RSS:${h.format_byte_size_binary(mem.rss)} - - VMS:${h.format_byte_size_binary(mem.vms)} - - AGE: ${h.age_component(h.time_to_utcdatetime(proc.create_time()))} - - MASTER -
- - | ${proc_child.pid} - ${get_name(proc_child)} - - - command - - - CPU: ${proc_child.cpu_percent()} % - - RSS:${h.format_byte_size_binary(mem.rss)} - <% mem_sum += mem.rss %> - - VMS:${h.format_byte_size_binary(mem.vms)} - - AGE: ${h.age_component(h.time_to_utcdatetime(proc_child.create_time()))} - - - restart - -
| total processes: ${len(children)}RSS:${h.format_byte_size_binary(mem_sum)}
--
+ <%include file='settings_process_management_data.mako'/>
- diff --git a/rhodecode/templates/admin/settings/settings_process_management_data.mako b/rhodecode/templates/admin/settings/settings_process_management_data.mako new file mode 100644 --- /dev/null +++ b/rhodecode/templates/admin/settings/settings_process_management_data.mako @@ -0,0 +1,93 @@ + + + <% + def get_name(proc): + cmd = ' '.join(proc.cmdline()) + if 'vcsserver.ini' in cmd: + return 'VCSServer' + elif 'rhodecode.ini' in cmd: + return 'RhodeCode' + return proc.name() + %> + + + + % for proc in c.gunicorn_processes: + <% mem = proc.memory_info()%> + <% children = proc.children(recursive=True) %> + % if children: + + + + + + + + + + + <% mem_sum = 0 %> + % for proc_child in children: + <% mem = proc_child.memory_info()%> + + + + + + + + + + % endfor + + + + + + + + + % endif + % endfor +
+ ${h.format_date(h.datetime.now())} +
+ + ${proc.pid} - ${get_name(proc)} + + + command + + + RSS:${h.format_byte_size_binary(mem.rss)} + + VMS:${h.format_byte_size_binary(mem.vms)} + + AGE: ${h.age_component(h.time_to_utcdatetime(proc.create_time()))} + + MASTER +
+ + | ${proc_child.pid} - ${get_name(proc_child)} + + + command + + + CPU: ${proc_child.cpu_percent()} % + + RSS:${h.format_byte_size_binary(mem.rss)} + <% mem_sum += mem.rss %> + + VMS:${h.format_byte_size_binary(mem.vms)} + + AGE: ${h.age_component(h.time_to_utcdatetime(proc_child.create_time()))} + + + restart + +
| total processes: ${len(children)}RSS:${h.format_byte_size_binary(mem_sum)}
--