some more threading stuff for backends.

This commit is contained in:
Johannes Findeisen 2013-10-20 04:09:46 +02:00
commit a0577c66ff
3 changed files with 11 additions and 8 deletions

View file

@ -124,17 +124,19 @@ def main():
job.set_logger(log) job.set_logger(log)
jobs.append(job) jobs.append(job)
#x = JsonrpcBackend() interface = LinspectorInterface(jobs, scheduler, linConf)
#x = JsonrpcBackend(interface)
#x.daemon = True #x.daemon = True
#x.start() #x.start()
#TODO: Load Backend Threads here before initializing the frontend. #TODO: load all backends in a loop
''' '''
for backend in backends.enabled for backend in backends.enabled
backend.start backend.start
take care of signals etc. to sthutdown the threads when stopping linspector. take care of signals etc. to sthutdown the threads when stopping linspector.
''' '''
interface = LinspectorInterface(jobs, scheduler, linConf)
LishFrontend(interface) LishFrontend(interface)
log.debug("shutting down scheduler") log.debug("shutting down scheduler")

View file

@ -27,5 +27,6 @@ import threading
class Backend(threading.Thread): class Backend(threading.Thread):
def __init__(self, **kwargs): def __init__(self, interface, **kwargs):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.interface = interface

View file

@ -25,11 +25,11 @@ from linspector.backends.backend import Backend
class JsonrpcBackend(Backend): class JsonrpcBackend(Backend):
def __init__(self, **kwargs): def __init__(self, interface, **kwargs):
super(Backend, self).__init__(**kwargs) super(Backend, self).__init__(**kwargs)
return self.interface = interface
def run(self): def run(self):
while True: while True:
print "foo" print "hello from JsonrpcBackend thread..."
time.sleep(5) time.sleep(5)