Ejemplo n.º 1
0
    populate_options["l2_binary_filename"] = args.binary
if (args.l2_config):
    populate_options["l2_config_filename"] = args.l2_config
populate_options["aggregate"] = args.aggregate
populate_options["abscoversion"] = args.absco_version
populate_options["target_cluster"] = args.target_cluster
populate_options["group_size"] = int(args.group_size)
populate_options["parallel_size"] = int(args.parallel_size)

for config_file in args.config_file:
    logger.info('Populating using configuration file: %s' % config_file)

    # Log any exceptions to disk then re-raise
    success = False
    try:
        p = PopulatorBase.create_populator_from_config_file(
            config_file, **populate_options)
        if (p is None):
            raise LookupError(
                'Could not determine config type from config contents or filename'
            )
        success = p.populate(config_file)
    except:
        # Will cause exception to print to screen
        logger.error('Error when populating using file: %s' % config_file)
        for tb_line in traceback.format_exception(*sys.exc_info()):
            logger.error(tb_line.strip())

if success:
    logger.info("Population was successful")
    sys.exit(0)
else:
Ejemplo n.º 2
0
    if cmd_options.run_type not in PopulatorBase.populator_list:
        parser.error('%s is not a valid run type, valid values are: [%s]' % (cmd_options.run_type, ', '.join(list(PopulatorBase.populator_list.keys()))))

    if cmd_options.config_filename == None:
        out_config_filename = '%s/%s_%s.config' % (os.getcwd(), cmd_options.run_type, os.path.basename(os.getcwd()))
    else:
        out_config_filename = cmd_options.config_filename

    if cmd_options.relative_paths:
        cfg_path = os.path.dirname(out_config_filename)
        used_files = [ os.path.relpath(curr_file, cfg_path) for curr_file in cmd_args ]
    else:
        used_files = [ os.path.realpath(curr_file) for curr_file in cmd_args ]

    populator = PopulatorBase.create_populator_from_config_type(cmd_options.run_type)
    if not os.path.exists(populator.config_template_file):
        raise IOError('Template config file does not exist: %s' % populator.config_template_file)
    
    tmpl_obj = L2InputFile(populator.config_template_file)

    sounding_ids = None
    if cmd_options.sounding_list_file != None:
        sounding_ids = populator.read_id_list_file(cmd_options.sounding_list_file)

    # Insert any alternative configuration values
    alt_settings_hash = parse_keyval_str_list(cmd_options.alternative_settings)
    insert_alternative_settings(tmpl_obj, alt_settings_hash)

    eval('handle_%s_config(tmpl_obj, out_config_filename, used_files, sounding_ids, cmd_options.run_type)' % cmd_options.run_type)
Ejemplo n.º 3
0
    populate_options["l2_binary_filename"] = args.binary
if args.l2_config:
    populate_options["l2_config_filename"] = args.l2_config
populate_options["aggregate"] = args.aggregate
populate_options["abscoversion"] = args.absco_version
populate_options["target_cluster"] = args.target_cluster
populate_options["group_size"] = int(args.group_size)
populate_options["parallel_size"] = int(args.parallel_size)

for config_file in args.config_file:
    logger.info("Populating using configuration file: %s" % config_file)

    # Log any exceptions to disk then re-raise
    success = False
    try:
        p = PopulatorBase.create_populator_from_config_file(config_file, **populate_options)
        if p is None:
            raise LookupError("Could not determine config type from config contents or filename")
        success = p.populate(config_file)
    except:
        # Will cause exception to print to screen
        logger.error("Error when populating using file: %s" % config_file)
        for tb_line in traceback.format_exception(*sys.exc_info()):
            logger.error(tb_line.strip())

if success:
    logger.info("Population was successful")
    sys.exit(0)
else:
    logger.error("Population failed")
    sys.exit(1)