added some stubs for backend threading

This commit is contained in:
Johannes Findeisen 2013-10-20 03:19:21 +02:00
commit 3a4c4c412e
3 changed files with 21 additions and 6 deletions

View file

@ -28,12 +28,13 @@ import logging
import logging.handlers import logging.handlers
import os import os
import os.path as path import os.path as path
import threading
from linspector.core.interface import LinspectorInterface from linspector.core.interface import LinspectorInterface
from linspector.config.parser import FullConfigParser from linspector.config.parser import FullConfigParser
from linspector.core.job import Job from linspector.core.job import Job
from linspector.core.scheduler import Scheduler from linspector.core.scheduler import Scheduler
from linspector.backends.https import HttpsBackend from linspector.backends.jsonrpc import JsonrpcBackend
from linspector.frontends.lish import LishFrontend from linspector.frontends.lish import LishFrontend
@ -123,6 +124,9 @@ def main():
job.set_logger(log) job.set_logger(log)
jobs.append(job) jobs.append(job)
#x = JsonrpcBackend()
#x.daemon = True
#x.start()
#TODO: Load Backend Threads here before initializing the frontend. #TODO: Load Backend Threads here before initializing the frontend.
''' '''
for backend in backends.enabled for backend in backends.enabled

View file

@ -1,6 +1,7 @@
""" """
Backends can be a http service or xml-rpc service; let's say background threads providing an interface somewhere. They Backends can be a http service or xml-rpc service; let's say
should run as background threads. background threads providing an interface somewhere. They should
run as background threads.
Backends are absolutely no requirement for running Linspector. 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 <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import threading
class Backend():
class Backend(threading.Thread):
def __init__(self, **kwargs): def __init__(self, **kwargs):
return threading.Thread.__init__(self)

View file

@ -19,9 +19,17 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import time
from linspector.backends.backend import Backend from linspector.backends.backend import Backend
class JsonrpcBackend(Backend): class JsonrpcBackend(Backend):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(Backend, self).__init__(**kwargs)
return return
def run(self):
while True:
print "foo"
time.sleep(5)