Commit 15437f00 authored by Swann Perarnau's avatar Swann Perarnau

[refactor] code cleanup for daemon

Remove unneeded module, clean up calls to the logger.
parent 6087e7fe
from __future__ import print_function from __future__ import print_function
import logging import logging
import random
import re import re
import signal import signal
import zmq import zmq
...@@ -74,7 +73,7 @@ class Daemon(object): ...@@ -74,7 +73,7 @@ class Daemon(object):
self.target = 1.0 self.target = 1.0
def do_application_receive(self, parts): def do_application_receive(self, parts):
self.logger.info("receiving application stream: " + repr(parts)) self.logger.info("receiving application stream: %r", parts)
identity = parts[0] identity = parts[0]
if len(parts[1]) == 0: if len(parts[1]) == 0:
...@@ -93,7 +92,7 @@ class Daemon(object): ...@@ -93,7 +92,7 @@ class Daemon(object):
application.append_buffer(parts[1]) application.append_buffer(parts[1])
for m in application.get_messages(): for m in application.get_messages():
application.do_transition(m) application.do_transition(m)
self.logger.info("application now in state: " + self.logger.info("application now in state: %s",
application.state) application.state)
def do_upstream_receive(self, msg): def do_upstream_receive(self, msg):
...@@ -123,7 +122,7 @@ class Daemon(object): ...@@ -123,7 +122,7 @@ class Daemon(object):
application.do_transition('d') application.do_transition('d')
else: else:
pass pass
self.logger.info("application now in state: " + application.state) self.logger.info("application now in state: %s", application.state)
def do_signal(self, signum, frame): def do_signal(self, signum, frame):
ioloop.IOLoop.current().add_callback_from_signal(self.do_shutdown) ioloop.IOLoop.current().add_callback_from_signal(self.do_shutdown)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment