def zmqPublish(opts, q): p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() for line in q: msg = 'traclink:' + line logging.debug('publishing: %s', msg) p.pubStream.send(msg)
def main(): import optparse parser = optparse.OptionParser('usage: %prog') ZmqPublisher.addOptions(parser, 'zmqPublish') parser.add_option( '-p', '--prefix', default='', help= 'Prefix to prepend to incoming lines before publishing them (DO include trailing "." if you want it)' ) opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() # start publishing an arbitrary message that central should forward pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(opts.prefix, p), 0.1) pubTimer.start() zmqLoop()
def zmqPublish(opts, q): p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() for line in q: msg = 'gpsposition:%s:%s:' % (opts.evaNumber, opts.trackName) + line logging.debug('publishing: %s', msg) p.pubStream.send(msg)
def __init__(self, logPath, opts): self.logPath = logPath self.logFile = None self.log = None self.opts = opts self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) self.publishTimer = None print 'topics:', self.opts.topic
def __init__(self, logPath, opts): self.logPath = logPath self.logFile = None self.log = None self.opts = opts self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) self.publishTimer = None print 'topics:', self.opts.topic
def zmqPublish(opts, q): p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() for line in q: msg = '%s:%s:%s:' % (opts.dataTopic, opts.evaNumber, opts.trackName) + line logging.debug('publishing: %s', msg) updateStatus(opts.evaNumber) p.pubStream.send(msg)
def __init__(self, opts): self.sources = ([PatternFileSource(x) for x in opts.watchFilePattern] + [DirectoryFileSource(x) for x in opts.watchDirectory] + [SymlinkFileSource(x) for x in opts.watchSymlink]) self.subtopic = opts.subtopic self.pollTimer = None self.stopPollingTime = None self.imageProcessor = None self.tmpDir = tempfile.mkdtemp(prefix='filePublisher') opts.moduleName = opts.moduleName.format(subtopic=opts.subtopic) self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts))
def main(): import optparse parser = optparse.OptionParser('usage: testLineSource.py testMessages.txt | %prog') ZmqPublisher.addOptions(parser, 'testPublisher') opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) publisher.start() ioloop.IOLoop.instance().add_handler(sys.stdin.fileno(), lambda fd, events: stdinHandler(publisher), ioloop.IOLoop.READ) zmqLoop()
def main(): import optparse parser = optparse.OptionParser( 'usage: testLineSource.py testMessages.txt | %prog') ZmqPublisher.addOptions(parser, 'testPublisher') opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) publisher.start() ioloop.IOLoop.instance().add_handler( sys.stdin.fileno(), lambda fd, events: stdinHandler(publisher), ioloop.IOLoop.READ) zmqLoop()
def main(): import optparse parser = optparse.OptionParser('usage: %prog') ZmqPublisher.addOptions(parser, 'testPublishAttachments') opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() # start publishing an arbitrary message that central should forward pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(p), 1000) pubTimer.start() zmqLoop()
def main(): import optparse parser = optparse.OptionParser('usage: %prog') ZmqPublisher.addOptions(parser, 'testPublishAttachments') opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() # start publishing an arbitrary message that central should forward pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(p), 1000) pubTimer.start() zmqLoop()
def main(): import optparse parser = optparse.OptionParser('usage: %prog') ZmqPublisher.addOptions(parser, 'zmqPublish') parser.add_option('-p', '--prefix', default='', help='Prefix to prepend to incoming lines before publishing them (DO include trailing "." if you want it)') opts, args = parser.parse_args() if args: parser.error('expected no args') logging.basicConfig(level=logging.DEBUG) # set up networking p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) p.start() # start publishing an arbitrary message that central should forward pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(opts.prefix, p), 0.1) pubTimer.start() zmqLoop()
def __init__(self, opts): self.request = { 'timeout': opts.timeout, 'pollPeriod': opts.pollPeriod, } if opts.timestampSpacing: self.request['timestampSpacing'] = opts.timestampSpacing if opts.imageResize: self.request['imageResize'] = parseImageResize(opts.imageResize) if opts.imageCrop: self.request['imageCrop'] = parseImageCrop(opts.imageCrop) if opts.imageFormat: self.request['imageFormat'] = opts.imageFormat self.outputDirectory = opts.output self.subtopic = opts.subtopic self.noRequest = opts.noRequest opts.moduleName = opts.moduleName.format(subtopic=opts.subtopic) self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts)) self.requestPeriod = 0.5 * opts.timeout
def __init__(self, opts): self.request = { 'timeout': opts.timeout, 'pollPeriod': opts.pollPeriod, } if opts.timestampSpacing: self.request['timestampSpacing'] = opts.timestampSpacing if opts.imageResize: self.request['imageResize'] = parseImageResize(opts.imageResize) if opts.imageCrop: self.request['imageCrop'] = parseImageCrop(opts.imageCrop) if opts.imageFormat: self.request['imageFormat'] = opts.imageFormat self.outputDirectory = opts.output self.subtopic = opts.subtopic self.noRequest = opts.noRequest opts.moduleName = opts.moduleName.format(subtopic=opts.subtopic) self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts)) self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(opts)) self.requestPeriod = 0.5 * opts.timeout
def __init__(self, opts): self.opts = opts self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(self.opts)) self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(self.opts))