Changeset - d6ec468112cb
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 7 years ago 2018-06-09 02:01:36
drewp@bigasterisk.com
not sure highwatermark setting did what i wanted
Ignore-this: 3a3b2835ea3a30d7fb0e2007a3b06bb2
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
bin/collector
Show inline comments
 
@@ -40,25 +40,25 @@ def parseJsonMessage(msg):
 
        settings.append((URIRef(device), URIRef(attr), value))
 
    return body['client'], body['clientSession'], settings, body['sendTime']
 

	
 
def startZmq(port, collector):
 
    stats = scales.collection('/zmqServer',
 
                              scales.PmfStat('setAttr'))
 
    
 
    zf = ZmqFactory()
 
    addr = 'tcp://*:%s' % port
 
    log.info('creating zmq endpoint at %r', addr)
 
    e = ZmqEndpoint('bind', addr)
 
    class Pull(ZmqPullConnection):
 
        highWaterMark = 3
 
        #highWaterMark = 3
 
        def onPull(self, message):
 
            with stats.setAttr.time():
 
                # todo: new compressed protocol where you send all URIs up
 
                # front and then use small ints to refer to devices and
 
                # attributes in subsequent requests.
 
                client, clientSession, settings, sendTime = parseJsonMessage(message[0])
 
                collector.setAttrs(client, clientSession, settings, sendTime)
 
        
 
    s = Pull(zf, e)
 

	
 

	
 
class WebListeners(object):
light9/dmxclient.py
Show inline comments
 
@@ -13,25 +13,25 @@ from light9 import networking
 
_dmx=None
 
log = logging.getLogger('dmxclient')
 

	
 
procname = os.path.basename(sys.argv[0])
 
procname = procname.replace('.py', '')
 
_id = "%s-%s-%s" % (procname, socket.gethostname(), os.getpid())
 

	
 
class TwistedZmqClient(object):
 
    def __init__(self, service):
 
        zf = ZmqFactory()
 
        e = ZmqEndpoint('connect', 'tcp://%s:%s' % (service.host, service.port))
 
        class Push(ZmqPushConnection):
 
            highWaterMark = 3
 
            pass # highWaterMark = 3000
 
        self.conn = Push(zf, e)
 
        
 
    def send(self, clientid, levellist):
 
        self.conn.push(json.dumps({'clientid': clientid, 'levellist': levellist}))
 

	
 
def outputlevels(levellist,twisted=0,clientid=_id):
 
    """present a list of dmx channel levels, each scaled from
 
    0..1. list can be any length- it will apply to the first len() dmx
 
    channels.
 

	
 
    if the server is not found, outputlevels will block for a
 
    second."""
0 comments (0 inline, 0 general)