def info(self): """Return a nested dictionary of information related to the actor status and performance. The dictionary contains the following entries: * ``actor`` a dictionary containing information regarding the type of actor and its status. * ``events`` a dictionary of information about the :ref:`event loop <asyncio-event-loop>` running the actor. * ``extra`` the :attr:`extra` attribute (you can use it to add stuff). * ``system`` system info. This method is invoked when you run the :ref:`info command <actor_info_command>` from another actor. """ if not self.started(): return isp = self.is_process() actor = { "name": self.name, "state": self.info_state, "actor_id": self.aid, "uptime": self._loop.time() - self._started, "thread_id": self.tid, "process_id": self.pid, "is_process": isp, "age": self.impl.age, } events = {"callbacks": len(self._loop._ready), "scheduled": len(self._loop._scheduled)} data = {"actor": actor, "events": events, "extra": self.extra} if isp: data["system"] = system.process_info(self.pid) self.fire_event("on_info", info=data) return data
def info(self): '''Return a nested dictionary of information related to the actor status and performance. The dictionary contains the following entries: * ``actor`` a dictionary containing information regarding the type of actor and its status. * ``events`` a dictionary of information about the :ref:`event loop <asyncio-event-loop>` running the actor. * ``extra`` the :attr:`extra` attribute (you can use it to add stuff). * ``system`` system info. This method is invoked when you run the :ref:`info command <actor_info_command>` from another actor. ''' if not self.started(): return isp = self.is_process() actor = {'name': self.name, 'state': self.info_state, 'actor_id': self.aid, 'uptime': time() - self._started, 'thread_id': self.tid, 'process_id': self.pid, 'is_process': isp, 'age': self.impl.age} events = {'callbacks': len(self._loop._ready), 'scheduled': len(self._loop._scheduled)} data = {'actor': actor, 'events': events, 'extra': self.extra} if isp: data['system'] = system.process_info(self.pid) self.fire_event('on_info', info=data) return data
def testMe(self): worker = get_actor() info = system.process_info(worker.pid) system.process_info() self.assertTrue(isinstance(info, dict))