Ejemplo n.º 1
0
    options.plugincheckfrequency = getConfig('plugincheckfrequency', 120,
                                             options.configfile)


if __name__ == '__main__':
    # configure ourselves
    parser = OptionParser()
    parser.add_option("-c",
                      dest='configfile',
                      default=sys.argv[0].replace('.py', '.conf'),
                      help="configuration file to use")
    (options, args) = parser.parse_args()
    initConfig()
    initLogger(options)

    # open ES connection globally so we don't waste time opening it per message
    es = esConnect()

    pluginList = registerPlugins()

    try:
        main()
    except KeyboardInterrupt as e:
        logger.info("Exiting worker")
        if options.esbulksize != 0:
            es.finish_bulk()
    except Exception as e:
        if options.esbulksize != 0:
            es.finish_bulk()
        raise
Ejemplo n.º 2
0
 def __init__(self, queue, esConnection, options):
     self.sqs_queue = queue
     self.esConnection = esConnection
     self.pluginList = registerPlugins()
     self.options = options