diff --git a/workers/app/emitter.py b/workers/app/emitter.py deleted file mode 100644 index 1d13fff7..00000000 --- a/workers/app/emitter.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# vim: ai ts=4 sts=4 et sw=4 nu - -""" zmq relay tester: emmit random messages to the `internal` channel """ - -import logging -import os -import random -import time - -import zmq - -SOCKET_URI = os.getenv("SOCKET_URI", "tcp://192.168.1.13:5000") -EVENTS = os.getenv("EVENTS", "requested-task,task-event").split(",") - -logger = logging.getLogger("emitter") - -if not logger.hasHandlers(): - logger.setLevel(logging.DEBUG) - handler = logging.StreamHandler() - handler.setFormatter(logging.Formatter("[%(asctime)s: %(levelname)s] %(message)s")) - logger.addHandler(handler) - - -def main(): - context = zmq.Context() - socket = context.socket(zmq.PUB) - - logger.info(f"connecting to {SOCKET_URI}…") - socket.connect(SOCKET_URI) - - while True: - message = "{} {}".format(random.choice(EVENTS), random.randint(0, 1000)) - logger.info(f"[SENDING] {message}") - socket.send_string(message) - time.sleep(random.randint(5, 20)) - - -if __name__ == "__main__": - main() diff --git a/workers/app/listener.py b/workers/app/listener.py deleted file mode 100644 index 826d4335..00000000 --- a/workers/app/listener.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# vim: ai ts=4 sts=4 et sw=4 nu - -""" zmq relay tester: listens to topic on relay's public channel """ - -import logging -import os - -import zmq - -SOCKET_URI = os.getenv("SOCKET_URI", "tcp://localhost:6000") -EVENTS = os.getenv("EVENTS", "requested-task,task-event").split(",") -logger = logging.getLogger("listener") - -if not logger.hasHandlers(): - logger.setLevel(logging.DEBUG) - handler = logging.StreamHandler() - handler.setFormatter(logging.Formatter("[%(asctime)s: %(levelname)s] %(message)s")) - logger.addHandler(handler) - - -def main(): - context = zmq.Context() - socket = context.socket(zmq.SUB) - - logger.info(f"connecting to {SOCKET_URI}…") - socket.connect(SOCKET_URI) - for event in EVENTS: - logger.debug(f"subscribing to topic `{event}`") - socket.setsockopt_string(zmq.SUBSCRIBE, event) - - while True: - received_string = socket.recv_string() - logger.info(f"[INCOMING] {received_string}") - - -if __name__ == "__main__": - main() diff --git a/workers/manager-requirements.txt b/workers/manager-requirements.txt index f96c81c3..dcc9f275 100644 --- a/workers/manager-requirements.txt +++ b/workers/manager-requirements.txt @@ -1,4 +1,3 @@ -zmq requests==2.31.0 docker==7.0.0 psutil==5.9.8