Пример #1
0
 def on_start(self):
     if coverage:
         cov = pulsar.process_local_data('COVERAGE')
         if not cov:
             # START COVERAGE FOR THIS PROCESS
             cov = coverage.coverage()
             pulsar.process_local_data().COVERAGE = cov
             cov.start()
             events.bind('exit', stop_coverage, sender=pulsar.Actor)
             
Пример #2
0
 def local(cls):
     #elem = threading.current_thread()
     elem = process_local_data()
     data = getattr(elem, '_css_local', None)
     if data is None:
         #data = threading.local()
         data = elem.local()
         elem._css_local = data
         bd = cls.make('body')
         data.real_body = None
         data.body = bd
     return elem._css_local
Пример #3
0
 def testTerminate(self):
     arbiter = pulsar.get_actor()
     self.assertTrue(arbiter.is_arbiter())
     yield self.spawn(actor_class=BogusActor, name='foo', timeout=1)
     proxy = self.a
     self.assertEqual(proxy.name, 'foo')
     proxy = arbiter.managed_actors[proxy.aid]
     self.assertEqual(proxy.stopping_loops, 0)
     time.sleep(1.5)
     n = arbiter.manage_actors()
     self.assertTrue(n)
     self.assertEqual(proxy.stopping_loops, 1)
     c = 0
     while c < 10 and proxy.aid in arbiter.managed_actors:
         c += 1
         yield pulsar.NOT_DONE
         arbiter.manage_actors()
     self.assertEqual(proxy.stopping_loops, ACTOR_STOPPING_LOOPS)
     thread_actors = pulsar.process_local_data('thread_actors')
     self.assertFalse(proxy.aid in thread_actors)
Пример #4
0
def stop_coverage(sender, **kwargs):
    cov = pulsar.process_local_data('COVERAGE')
    cov.stop()