Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update klara-dispatcher compatible python3 #32

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions dispatcher/klara-dispatcher
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import logging
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
Expand Down Expand Up @@ -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 ###### ")
Expand Down Expand Up @@ -192,4 +204,4 @@ if __name__ == "__main__":
# End initial work

app.listen(config.listen_port)
tornado.ioloop.IOLoop.instance().start()
tornado.ioloop.IOLoop.instance().start()
2 changes: 1 addition & 1 deletion worker/klara-worker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import time
Expand Down