예제 #1
0
파일: actor.py 프로젝트: BazookaShao/pulsar
    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 event loop running the
  actor.
* ``extra`` the :attr:`extra` attribute (which you can use 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.event_loop._callbacks),
                  'io_loops': self.event_loop.num_loops}
        data = {'actor': actor,
                'events': events,
                'extra': self.extra}
        if isp:
            data['system'] = system.system_info(self.pid)
        self.fire_event('on_info', info=data)
        return data
예제 #2
0
파일: actor.py 프로젝트: cyberj/pulsar
    def info(self):
        '''return A dictionary of information related to the actor
status and performance.'''
        if not self.started():
            return
        isp = self.is_process()
        requestloop  = self.requestloop
        actor = {'name': self.name,
                 'state': self.info_state,
                 'actor_id': self.aid,
                 'uptime': time() - requestloop._started,
                 'thread_id': self.tid,
                 'process_id': self.pid,
                 'is_process': isp,
                 'internal_connections': self.mailbox.active_connections,
                 'age': self.impl.age}
        events = {'request processed': self.request_processed,
                  'callbacks': len(self.ioloop._callbacks),
                  'io_loops': self.ioloop.num_loops}
        if self.cpubound:
            events['request_loops'] = requestloop.num_loops
        data = {'actor': actor, 'events': events}
        if isp:
            data['system'] = system.system_info(self.pid)
        return self.on_info(data)
예제 #3
0
    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 event loop running the
  actor.
* ``extra`` the :attr:`extra` attribute (which you can use 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.event_loop._callbacks),
            'io_loops': self.event_loop.num_loops
        }
        data = {'actor': actor, 'events': events, 'extra': self.extra}
        if isp:
            data['system'] = system.system_info(self.pid)
        self.fire_event('on_info', info=data)
        return data
예제 #4
0
파일: tools.py 프로젝트: japaks/pulsar
 def testMe(self):
     worker = get_actor()
     info = system.system_info(worker.pid)
     self.assertTrue(isinstance(info, dict))