예제 #1
0
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)
예제 #2
0
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()
예제 #3
0
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)
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
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)
예제 #7
0
    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))
예제 #8
0
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()
예제 #9
0
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()
예제 #11
0
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()
예제 #12
0
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()
예제 #13
0
    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
예제 #14
0
    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
예제 #15
0
 def __init__(self, opts):
     self.opts = opts
     self.subscriber = ZmqSubscriber(**ZmqSubscriber.getOptionValues(self.opts))
     self.publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(self.opts))