From 1f5ade73490d2c9e139be64a320b1895bca6d6d7 Mon Sep 17 00:00:00 2001 From: Eric Stein Date: Sun, 14 Sep 2014 14:29:04 -0500 Subject: [PATCH] redoing chillmon zmq use as zmqfan use --- chillmon | 10 +++++----- pidset | 4 ++-- requirements.txt | 1 + watch.py | 4 ++-- web.py | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 requirements.txt diff --git a/chillmon b/chillmon index f5ca60f..99ea7fd 100755 --- a/chillmon +++ b/chillmon @@ -228,17 +228,17 @@ if __name__ == '__main__' : zmqctrl = None try : url = sys.argv[4] - import zmqsub - zmqpub = zmqsub.JSONZMQBindPub(url) + from zmqfan import zmqsub + zmqpub = zmqsub.BindPub(url) try : - zmqctrl = zmqsub.JSONZMQBindSub(sys.argv[5]) + zmqctrl = zmqsub.BindSub(sys.argv[5]) except IndexError : pass except IndexError : pass - temp_probes = {'beer' : beer, 'room' : room, 'beertop' : beertop} - pid = PID(beer, 66) # TODO configuration system for what temp to stick to + temp_probes = {'beer' : beer, 'room' : room} + pid = PID(beer, 72) # TODO configuration system for what temp to stick to chill = ChillmonBotThread(sys.argv[1], sys.argv[2], sys.argv[3], temp_probes, pid, zmqpub=zmqpub, zmqctrl=zmqctrl) chill.run() diff --git a/pidset b/pidset index cfe49b6..c520e41 100755 --- a/pidset +++ b/pidset @@ -1,8 +1,8 @@ #!/usr/bin/env python -import zmqsub +from zmqfan import zmqsub import sys import pidvarmap -ct = zmqsub.JSONZMQConnectPub(sys.argv[1]) +ct = zmqsub.ConnectPub(sys.argv[1]) ct.send({'cmd': 'set', 'k' : sys.argv[2], 'v' : pidvarmap.typemap[sys.argv[2]](sys.argv[3])}) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f36aeec --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +git+https://github.com/eastein/zmqfan.git@develop-0.6#egg=zmqfan diff --git a/watch.py b/watch.py index 73b5ab4..c527556 100644 --- a/watch.py +++ b/watch.py @@ -1,10 +1,10 @@ -import zmqsub +from zmqfan import zmqsub import sys import time import pprint if __name__ == '__main__' : - sub = zmqsub.JSONZMQSub(sys.argv[1]) + sub = zmqsub.ConnectSub(sys.argv[1]) while True : pprint.pprint(sub.last_msg()) time.sleep(1.0) diff --git a/web.py b/web.py index ea27964..48dece0 100644 --- a/web.py +++ b/web.py @@ -1,6 +1,6 @@ import tornado.web import tornado.ioloop -import zmqsub +from zmqfan import zmqsub import threading import re import sys @@ -169,7 +169,7 @@ def process_request(self, tracetype, tracename, *a): (r"/trace/([a-z0-9\.\-_]+)/([a-z0-9\.\-_]+)/([0-9]+)$", TraceHandler) ] - sock = zmqsub.JSONZMQSub(sys.argv[1]) + sock = zmqsub.ConnectSub(sys.argv[1]) tt = TraceThread(sock) tt.start() traces = tt