From 3a4c4c412e57085601310dbb4057e5800bf83f97 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Sun, 20 Oct 2013 03:19:21 +0200 Subject: [PATCH] added some stubs for backend threading --- bin/linspector | 6 +++++- linspector/backends/backend.py | 11 +++++++---- linspector/backends/jsonrpc.py | 10 +++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/bin/linspector b/bin/linspector index 5eee4c3..0a8f6d6 100755 --- a/bin/linspector +++ b/bin/linspector @@ -28,12 +28,13 @@ import logging import logging.handlers import os import os.path as path +import threading from linspector.core.interface import LinspectorInterface from linspector.config.parser import FullConfigParser from linspector.core.job import Job from linspector.core.scheduler import Scheduler -from linspector.backends.https import HttpsBackend +from linspector.backends.jsonrpc import JsonrpcBackend from linspector.frontends.lish import LishFrontend @@ -123,6 +124,9 @@ def main(): job.set_logger(log) jobs.append(job) + #x = JsonrpcBackend() + #x.daemon = True + #x.start() #TODO: Load Backend Threads here before initializing the frontend. ''' for backend in backends.enabled diff --git a/linspector/backends/backend.py b/linspector/backends/backend.py index 89e6f68..14b2194 100644 --- a/linspector/backends/backend.py +++ b/linspector/backends/backend.py @@ -1,6 +1,7 @@ """ -Backends can be a http service or xml-rpc service; let's say background threads providing an interface somewhere. They -should run as background threads. +Backends can be a http service or xml-rpc service; let's say +background threads providing an interface somewhere. They should +run as background threads. Backends are absolutely no requirement for running Linspector. @@ -22,7 +23,9 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . """ +import threading -class Backend(): + +class Backend(threading.Thread): def __init__(self, **kwargs): - return \ No newline at end of file + threading.Thread.__init__(self) \ No newline at end of file diff --git a/linspector/backends/jsonrpc.py b/linspector/backends/jsonrpc.py index 54ac2be..4d63828 100644 --- a/linspector/backends/jsonrpc.py +++ b/linspector/backends/jsonrpc.py @@ -19,9 +19,17 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . """ +import time + from linspector.backends.backend import Backend class JsonrpcBackend(Backend): def __init__(self, **kwargs): - return \ No newline at end of file + super(Backend, self).__init__(**kwargs) + return + + def run(self): + while True: + print "foo" + time.sleep(5)