Fix envvar imports

This commit is contained in:
Bálint Bokros 2018-02-09 14:21:17 +01:00
parent 28e83de0d7
commit 2499c4759e
3 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,7 @@ import zmq
from zmq.eventloop import ioloop
from zmq.eventloop.zmqstream import ZMQStream
from tfw.config import CONTROLLER_PORT
from tfw.config import tfwenv
from tfw.util import ZMQConnectorBase
ioloop.install()
@ -12,7 +12,7 @@ class ControllerConnector(ZMQConnectorBase):
def __init__(self, zmq_context=None):
super(ControllerConnector, self).__init__(zmq_context)
self._zmq_rep_socket = self._zmq_context.socket(zmq.REP)
self._zmq_rep_socket.connect('tcp://localhost:{}'.format(CONTROLLER_PORT))
self._zmq_rep_socket.connect('tcp://localhost:{}'.format(tfwenv.CONTROLLER_PORT))
self._zmq_rep_stream = ZMQStream(self._zmq_rep_socket)
self.register_callback = self._zmq_rep_stream.on_recv_stream

View File

@ -1,7 +1,7 @@
import zmq
from zmq.eventloop import ioloop
from tfw.config import CONTROLLER_PORT
from tfw.config import tfwenv
from tfw.util import ZMQConnectorBase
from tfw.networking.serialization import serialize_all, deserialize_all
@ -12,7 +12,7 @@ class SolvableConnector(ZMQConnectorBase):
def __init__(self, zmq_context=None):
super(SolvableConnector, self).__init__(zmq_context)
self._zmq_req_socket = self._zmq_context.socket(zmq.REQ)
self._zmq_req_socket.bind('tcp://*:{}'.format(CONTROLLER_PORT))
self._zmq_req_socket.bind('tcp://*:{}'.format(tfwenv.CONTROLLER_PORT))
def send(self, key, message):
self._zmq_req_socket.send_multipart(serialize_all(key, message))

View File

@ -1,7 +1,7 @@
from tornado.ioloop import IOLoop
from tornado.web import Application
from tfw.config import CRP_LISTENER_PORT, AVATAO_SECRET
from tfw.config import tfwenv, AVATAO_SECRET
from handlers import SolutionCheckHandler, TestHandler
from tfw.networking.solvable_connector import SolvableConnector
@ -17,6 +17,6 @@ if __name__ == '__main__':
app = Application(
routes
)
app.listen(CRP_LISTENER_PORT)
log.debug('Controller listening on {}'.format(CRP_LISTENER_PORT))
app.listen(tfwenv.CRP_LISTENER_PORT)
log.debug('Controller listening on {}'.format(tfwenv.CRP_LISTENER_PORT))
IOLoop.instance().start()