mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:11:32 +00:00
Fix envvar imports
This commit is contained in:
parent
28e83de0d7
commit
2499c4759e
@ -2,7 +2,7 @@ import zmq
|
|||||||
from zmq.eventloop import ioloop
|
from zmq.eventloop import ioloop
|
||||||
from zmq.eventloop.zmqstream import ZMQStream
|
from zmq.eventloop.zmqstream import ZMQStream
|
||||||
|
|
||||||
from tfw.config import CONTROLLER_PORT
|
from tfw.config import tfwenv
|
||||||
from tfw.util import ZMQConnectorBase
|
from tfw.util import ZMQConnectorBase
|
||||||
|
|
||||||
ioloop.install()
|
ioloop.install()
|
||||||
@ -12,7 +12,7 @@ class ControllerConnector(ZMQConnectorBase):
|
|||||||
def __init__(self, zmq_context=None):
|
def __init__(self, zmq_context=None):
|
||||||
super(ControllerConnector, self).__init__(zmq_context)
|
super(ControllerConnector, self).__init__(zmq_context)
|
||||||
self._zmq_rep_socket = self._zmq_context.socket(zmq.REP)
|
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._zmq_rep_stream = ZMQStream(self._zmq_rep_socket)
|
||||||
|
|
||||||
self.register_callback = self._zmq_rep_stream.on_recv_stream
|
self.register_callback = self._zmq_rep_stream.on_recv_stream
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import zmq
|
import zmq
|
||||||
from zmq.eventloop import ioloop
|
from zmq.eventloop import ioloop
|
||||||
|
|
||||||
from tfw.config import CONTROLLER_PORT
|
from tfw.config import tfwenv
|
||||||
from tfw.util import ZMQConnectorBase
|
from tfw.util import ZMQConnectorBase
|
||||||
from tfw.networking.serialization import serialize_all, deserialize_all
|
from tfw.networking.serialization import serialize_all, deserialize_all
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ class SolvableConnector(ZMQConnectorBase):
|
|||||||
def __init__(self, zmq_context=None):
|
def __init__(self, zmq_context=None):
|
||||||
super(SolvableConnector, self).__init__(zmq_context)
|
super(SolvableConnector, self).__init__(zmq_context)
|
||||||
self._zmq_req_socket = self._zmq_context.socket(zmq.REQ)
|
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):
|
def send(self, key, message):
|
||||||
self._zmq_req_socket.send_multipart(serialize_all(key, message))
|
self._zmq_req_socket.send_multipart(serialize_all(key, message))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from tornado.web import Application
|
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 handlers import SolutionCheckHandler, TestHandler
|
||||||
from tfw.networking.solvable_connector import SolvableConnector
|
from tfw.networking.solvable_connector import SolvableConnector
|
||||||
|
|
||||||
@ -17,6 +17,6 @@ if __name__ == '__main__':
|
|||||||
app = Application(
|
app = Application(
|
||||||
routes
|
routes
|
||||||
)
|
)
|
||||||
app.listen(CRP_LISTENER_PORT)
|
app.listen(tfwenv.CRP_LISTENER_PORT)
|
||||||
log.debug('Controller listening on {}'.format(CRP_LISTENER_PORT))
|
log.debug('Controller listening on {}'.format(tfwenv.CRP_LISTENER_PORT))
|
||||||
IOLoop.instance().start()
|
IOLoop.instance().start()
|
||||||
|
Loading…
Reference in New Issue
Block a user