Пример #1
0
def run_component(component_name, config_file):
    results = ConfigParser.parse_components(config_file)
    components = extract_components(results)
    item = components[component_name]

    logging.debug("Starting consumer type: %s" % (component_name))
    item.periodic_consume(2.0)

    while True:
        time.sleep(10)
Пример #2
0
logging.error("[XXXXXXX] Starting")
if __name__ == '__main__':
    args = parser.parse_args()
    if args.config is None:
        parser.print_help()
        sys.exit(1)

    try:
        os.stat(args.config)
    except:
        logging.error("[X] Error file does not exist")
        sys.exit(1)

    component_procs = {}
    
    results = ConfigParser.parse_components(args.config)
    components = extract_components(results)
    if args.reset:
        reset_components(components)

    cname = None
    if args.name != "ALL":
        cname = args.name
        logging.info("Creating process for  %s"%cname)
        component_procs[cname] = multiprocessing.Process(name=cname, target=run_component, args=(cname, args.config))
        logging.info("Starting %s"%cname)
        component_procs[cname].start()

    else:
        # start all the components in separate procs
        for name, item in components.items():