From 3c5919fa829af029a4ec420de527423b1f60034c Mon Sep 17 00:00:00 2001 From: Nono Date: Thu, 17 Aug 2023 16:16:50 +0200 Subject: [PATCH 1/3] Update klara-dispatcher compatible python3 importing python3 Replacing torndb by MySQLdb module writing a wrapper to replace torndb.query() calls. --- dispatcher/klara-dispatcher | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dispatcher/klara-dispatcher b/dispatcher/klara-dispatcher index 4d20687..693ad9e 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 emualte 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() From 49ea2f5213b47ba24882643c052b67340af09a16 Mon Sep 17 00:00:00 2001 From: Nono Date: Thu, 17 Aug 2023 16:19:50 +0200 Subject: [PATCH 2/3] Update klara-dispatcher typo --- dispatcher/klara-dispatcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dispatcher/klara-dispatcher b/dispatcher/klara-dispatcher index 693ad9e..fa1e741 100644 --- a/dispatcher/klara-dispatcher +++ b/dispatcher/klara-dispatcher @@ -164,7 +164,7 @@ class MainHandler(BaseHandler): self.write("Klara Job Dispatcher") class torndb: - """ Compatiblity wrapper to emualte torndb using the mysqlclient library. + """ Compatiblity wrapper to emulate torndb using the mysqlclient library. """ class Connection: def __init__(self, **kwargs): From c43f0711f2becc5745aa370e7acb722f42658b1c Mon Sep 17 00:00:00 2001 From: Nono Date: Thu, 17 Aug 2023 16:20:28 +0200 Subject: [PATCH 3/3] Update klara-worker with python3 including python3 --- worker/klara-worker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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