diff --git a/dispatcher/klara-dispatcher b/dispatcher/klara-dispatcher index 4d20687..fa1e741 100644 --- a/dispatcher/klara-dispatcher +++ b/dispatcher/klara-dispatcher @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import logging @@ -6,7 +6,7 @@ import tornado.ioloop import tornado.web import tornado.escape import config -import torndb +import MySQLdb from interfaces import mysql as mysql_interface from interfaces import notification as notify_interface from interfaces import validators @@ -163,6 +163,18 @@ class MainHandler(BaseHandler): def get(self): self.write("Klara Job Dispatcher") +class torndb: + """ Compatiblity wrapper to emulate torndb using the mysqlclient library. + """ + class Connection: + def __init__(self, **kwargs): + self._conn = MySQLdb.connect(**kwargs) + self._cursor = self._conn.cursor(MySQLdb.cursors.DictCursor) + + def query(self, query, *args): + self._cursor.execute(query, args) + return self._cursor.fetchall() + if __name__ == "__main__": _setup_logging() logging.info(" ###### Starting KLara Job Dispatcher ###### ") @@ -192,4 +204,4 @@ if __name__ == "__main__": # End initial work app.listen(config.listen_port) - tornado.ioloop.IOLoop.instance().start() \ No newline at end of file + tornado.ioloop.IOLoop.instance().start() diff --git a/worker/klara-worker b/worker/klara-worker index 6da85ea..c6d1c22 100644 --- a/worker/klara-worker +++ b/worker/klara-worker @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import time