/**
* @param args
*/
public static void main(String[] vargs) throws Exception {
ArgumentsParser.DISABLE_UPDATE_CATALOG = true;
ArgumentsParser args = ArgumentsParser.load(vargs);
args.require(ArgumentsParser.PARAM_CATALOG_TYPE, ArgumentsParser.PARAM_CATALOG_OUTPUT);
// ProjectType type = args.catalog_type;
String catalogOutputPath = args.getParam(ArgumentsParser.PARAM_CATALOG_OUTPUT);
// Populate Parameter Mappings
if (args.hasParam(ArgumentsParser.PARAM_MAPPINGS)) {
File input_path = args.getFileParam(ArgumentsParser.PARAM_MAPPINGS);
if (input_path.exists()) {
ParameterMappingsSet mappings = new ParameterMappingsSet();
mappings.load(input_path, args.catalog_db);
ParametersUtil.applyParameterMappings(args.catalog_db, mappings);
LOG.debug("Applied ParameterMappings file to '" + input_path + "' catalog parameter mappings...");
} else {
LOG.warn("ParameterMappings file '" + input_path + "' does not exist. Ignoring...");
}
}
// Fix the catalog!
// populateCatalog(args.catalog_db, type);
// Populate host information
Catalog new_catalog = args.catalog;
if (args.hasIntParam(ArgumentsParser.PARAM_CATALOG_NUM_HOSTS)) {
String host_format = args.getParam(ArgumentsParser.PARAM_CATALOG_HOSTS);
int num_hosts = args.getIntParam(ArgumentsParser.PARAM_CATALOG_NUM_HOSTS);
int num_sites_per_host = (args.hasIntParam(ArgumentsParser.PARAM_CATALOG_SITES_PER_HOST) ? args.getIntParam(ArgumentsParser.PARAM_CATALOG_SITES_PER_HOST) : 2);
int num_partitions_per_site = (args.hasIntParam(ArgumentsParser.PARAM_CATALOG_PARTITIONS_PER_SITE) ? args.getIntParam(ArgumentsParser.PARAM_CATALOG_PARTITIONS_PER_SITE) : 2);
if (host_format == null) {
FixCatalog.updateCatalog(new_catalog, num_hosts, num_sites_per_host, num_partitions_per_site);
} else {
FixCatalog.updateCatalog(new_catalog, host_format, num_hosts, num_sites_per_host, num_partitions_per_site);
}
// Use host list
} else {
String hostsInfo = args.getParam(ArgumentsParser.PARAM_CATALOG_HOSTS);
ClusterConfiguration cc = new ClusterConfiguration(hostsInfo);
FixCatalog.updateCatalog(new_catalog, cc);
}
// Now construct the new Dtxn.Coordinator configuration