Rename TFWENV and TAOENV constants to use capital letters

This commit is contained in:
Kristóf Tóth 2018-03-25 16:36:31 +02:00
parent ec469c6b75
commit 1982a3c869
8 changed files with 19 additions and 19 deletions

View File

@ -1,3 +1,3 @@
from envvars import generate_namedtuple_from_prefixed_envvars from envvars import generate_namedtuple_from_prefixed_envvars
taoenv = generate_namedtuple_from_prefixed_envvars('AVATAO_', 'taoenvtuple') TAOENV = generate_namedtuple_from_prefixed_envvars('AVATAO_', 'taoenvtuple')

View File

@ -3,11 +3,11 @@ from xmlrpc.client import Fault as SupervisorFault
from contextlib import suppress from contextlib import suppress
from os import remove from os import remove
from tfw.config import tfwenv from tfw.config import TFWENV
class SupervisorMixin: class SupervisorMixin:
supervisor = xmlrpc.client.ServerProxy(tfwenv.SUPERVISOR_HTTP_URI).supervisor supervisor = xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor
def stop_process(self, process_name): def stop_process(self, process_name):
with suppress(SupervisorFault): with suppress(SupervisorFault):

View File

@ -1,7 +1,7 @@
from tfw.components.terminado_mini_server import TerminadoMiniServer from tfw.components.terminado_mini_server import TerminadoMiniServer
from tfw.components.history_monitor import HistoryMonitor from tfw.components.history_monitor import HistoryMonitor
from tfw.event_handler_base import TriggerlessEventHandler from tfw.event_handler_base import TriggerlessEventHandler
from tfw.config import tfwenv from tfw.config import TFWENV
from tfw.config.logs import logging from tfw.config.logs import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -10,9 +10,9 @@ LOG = logging.getLogger(__name__)
class TerminadoEventHandler(TriggerlessEventHandler): class TerminadoEventHandler(TriggerlessEventHandler):
def __init__(self, key): def __init__(self, key):
super().__init__(key) super().__init__(key)
self.working_directory = tfwenv.TERMINADO_DIR self.working_directory = TFWENV.TERMINADO_DIR
self._historymonitor = HistoryMonitor(tfwenv.HISTFILE) self._historymonitor = HistoryMonitor(TFWENV.HISTFILE)
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash']) self.terminado_server = TerminadoMiniServer('/terminal', TFWENV.TERMINADO_PORT, TFWENV.TERMINADO_WD, ['bash'])
self.commands = {'write': self.write, self.commands = {'write': self.write,
'read': self.read} 'read': self.read}
self._historymonitor.watch() self._historymonitor.watch()

View File

@ -2,7 +2,7 @@ from tornado.ioloop import IOLoop
from tornado.web import Application from tornado.web import Application
from terminado import TermSocket, SingleTermManager from terminado import TermSocket, SingleTermManager
from tfw.config import tfwenv from tfw.config import TFWENV
from tfw.config.logs import logging from tfw.config.logs import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -42,6 +42,6 @@ class TerminadoMiniServer:
if __name__ == '__main__': if __name__ == '__main__':
LOG.info('Terminado Mini Server listening on %s', tfwenv.TERMINADO_PORT) LOG.info('Terminado Mini Server listening on %s', TFWENV.TERMINADO_PORT)
TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash']).listen() TerminadoMiniServer('/terminal', TFWENV.TERMINADO_PORT, TFWENV.TERMINADO_WD, ['bash']).listen()
IOLoop.instance().start() IOLoop.instance().start()

View File

@ -1,3 +1,3 @@
from envvars import generate_namedtuple_from_prefixed_envvars from envvars import generate_namedtuple_from_prefixed_envvars
tfwenv = generate_namedtuple_from_prefixed_envvars('TFW_', 'tfwenvtuple') TFWENV = generate_namedtuple_from_prefixed_envvars('TFW_', 'tfwenvtuple')

View File

@ -1,7 +1,7 @@
import zmq import zmq
from zmq.eventloop.zmqstream import ZMQStream from zmq.eventloop.zmqstream import ZMQStream
from tfw.config import tfwenv from tfw.config import TFWENV
from tfw.networking.zmq_connector_base import ZMQConnectorBase from tfw.networking.zmq_connector_base import ZMQConnectorBase
@ -9,7 +9,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(tfwenv.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

View File

@ -4,7 +4,7 @@ import zmq
from zmq.eventloop.zmqstream import ZMQStream from zmq.eventloop.zmqstream import ZMQStream
from tfw.networking.serialization import serialize_all from tfw.networking.serialization import serialize_all
from tfw.config import tfwenv from tfw.config import TFWENV
from tfw.networking.zmq_connector_base import ZMQConnectorBase from tfw.networking.zmq_connector_base import ZMQConnectorBase
@ -12,7 +12,7 @@ class ServerDownlinkConnector(ZMQConnectorBase):
def __init__(self, zmq_context=None): def __init__(self, zmq_context=None):
super(ServerDownlinkConnector, self).__init__(zmq_context) super(ServerDownlinkConnector, self).__init__(zmq_context)
self._zmq_sub_socket = self._zmq_context.socket(zmq.SUB) self._zmq_sub_socket = self._zmq_context.socket(zmq.SUB)
self._zmq_sub_socket.connect('tcp://localhost:{}'.format(tfwenv.PUBLISHER_PORT)) self._zmq_sub_socket.connect('tcp://localhost:{}'.format(TFWENV.PUBLISHER_PORT))
self._zmq_sub_stream = ZMQStream(self._zmq_sub_socket) self._zmq_sub_stream = ZMQStream(self._zmq_sub_socket)
self.subscribe = partial(self._zmq_sub_socket.setsockopt_string, zmq.SUBSCRIBE) self.subscribe = partial(self._zmq_sub_socket.setsockopt_string, zmq.SUBSCRIBE)
@ -24,7 +24,7 @@ class ServerUplinkConnector(ZMQConnectorBase):
def __init__(self, zmq_context=None): def __init__(self, zmq_context=None):
super(ServerUplinkConnector, self).__init__(zmq_context) super(ServerUplinkConnector, self).__init__(zmq_context)
self._zmq_push_socket = self._zmq_context.socket(zmq.PUSH) self._zmq_push_socket = self._zmq_context.socket(zmq.PUSH)
self._zmq_push_socket.connect('tcp://localhost:{}'.format(tfwenv.RECEIVER_PORT)) self._zmq_push_socket.connect('tcp://localhost:{}'.format(TFWENV.RECEIVER_PORT))
def send_to_eventhandler(self, key, message): def send_to_eventhandler(self, key, message):
message['data']['key'] = key message['data']['key'] = key

View File

@ -3,7 +3,7 @@ from zmq.eventloop.zmqstream import ZMQStream
from tfw.networking.zmq_connector_base import ZMQConnectorBase from tfw.networking.zmq_connector_base import ZMQConnectorBase
from tfw.networking.serialization import serialize_all from tfw.networking.serialization import serialize_all
from tfw.config import tfwenv from tfw.config import TFWENV
from tfw.config.logs import logging from tfw.config.logs import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -14,7 +14,7 @@ class EventHandlerDownlinkConnector(ZMQConnectorBase):
super(EventHandlerDownlinkConnector, self).__init__(zmq_context) super(EventHandlerDownlinkConnector, self).__init__(zmq_context)
self._zmq_pull_socket = self._zmq_context.socket(zmq.PULL) self._zmq_pull_socket = self._zmq_context.socket(zmq.PULL)
self._zmq_pull_stream = ZMQStream(self._zmq_pull_socket) self._zmq_pull_stream = ZMQStream(self._zmq_pull_socket)
address = 'tcp://*:{}'.format(tfwenv.RECEIVER_PORT) address = 'tcp://*:{}'.format(TFWENV.RECEIVER_PORT)
self._zmq_pull_socket.bind(address) self._zmq_pull_socket.bind(address)
LOG.debug('Pull socket bound to %s', address) LOG.debug('Pull socket bound to %s', address)
@ -23,7 +23,7 @@ class EventHandlerUplinkConnector(ZMQConnectorBase):
def __init__(self, zmq_context=None): def __init__(self, zmq_context=None):
super(EventHandlerUplinkConnector, self).__init__(zmq_context) super(EventHandlerUplinkConnector, self).__init__(zmq_context)
self._zmq_pub_socket = self._zmq_context.socket(zmq.PUB) self._zmq_pub_socket = self._zmq_context.socket(zmq.PUB)
address = 'tcp://*:{}'.format(tfwenv.PUBLISHER_PORT) address = 'tcp://*:{}'.format(TFWENV.PUBLISHER_PORT)
self._zmq_pub_socket.bind(address) self._zmq_pub_socket.bind(address)
LOG.debug('Pub socket bound to %s', address) LOG.debug('Pub socket bound to %s', address)