def handle_send(self): while True: try: items = dict() for _service in store.find(Service): items[_service.name] = { 'name': _service.name, 'description': _service.description, 'running': False, } services2exe = all_services_exe() exe2services = dict([(v, k) for k, v in services2exe.items()]) for p in psutil.process_iter(): try: _exe = p.exe if _exe in exe2services: items[exe2services.get(_exe)]['running'] = True except (psutil.error.AccessDenied, psutil.error.NoSuchProcess): pass except Exception, e: logger.error(e) broadcast(self.channel_name, items) except Exception, e: logger.error(e) logger.error(traceback.format_exc())
def services_activity(self): try: items = dict() for _service in store.find(Service): items[_service.name] = { 'name': _service.name, 'description': _service.description, 'running': False, } services2exe = all_services_exe() exe2services = dict([(v, k) for k, v in services2exe.items()]) for p in psutil.process_iter(): try: _exe = p.exe if _exe in exe2services: items[exe2services.get(_exe)]['running'] = True except (psutil.error.AccessDenied, psutil.error.NoSuchProcess): pass except Exception, e: logger.error(e) return items