[PEAK] problem with peak.io_events
Vladimir Iliev
vlado at vintech.bg
Wed Sep 8 09:54:17 EDT 2004
Hi,
I'm trying to create simple event driven app which should listen for
signals but my callback func never gets called no matter what signal I
send to the app (see the attachment). What am I doing wrong ?
-------------- next part --------------
from peak.api import *
from peak.running.commands import EventDriven
from peak.running.daemons import AdaptiveTask
from peak.events.io_events import signals, signal_names
from peak.running.interfaces import ITaskQueue
from peak.events.interfaces import ISignalSource
from itertools import count
count = count()
class MyTask(AdaptiveTask):
def getWork(self):
return count.next()
def doWork(self, job):
print job
class Comp(binding.Component):
def _setup(self):
def cb(*a): print 'cb:',a
ss = self.lookupComponent(ISignalSource)
ss.signals(tuple(signal_names)).addCallback(cb)
MyTask(self, runEvery=1)
_setup = binding.Make(_setup, uponAssembly=True)
class MyApp(EventDriven):
commands = binding.Make(Comp, uponAssembly=True)
if __name__ == '__main__':
MyApp(config.makeRoot()).run()
More information about the PEAK
mailing list