use of edu.iu.dsc.tws.common.config.Config in project twister2 by DSC-SPIDAL.
the class WordCountJob method main.
public static void main(String[] args) {
// first load the configurations from command line and config files
Config config = ResourceAllocator.loadConfig(new HashMap<>());
// build JobConfig
JobConfig jobConfig = new JobConfig();
BasicJob.BasicJobBuilder jobBuilder = BasicJob.newBuilder();
jobBuilder.setName("streaming-wordcount");
jobBuilder.setContainerClass(WordCountContainer.class.getName());
jobBuilder.setRequestResource(new ResourceContainer(2, 1024), 4);
jobBuilder.setConfig(jobConfig);
// now submit the job
Twister2Submitter.submitContainerJob(jobBuilder.build(), config);
}
use of edu.iu.dsc.tws.common.config.Config in project twister2 by DSC-SPIDAL.
the class Test method testLoadConfig.
public static void testLoadConfig() {
String twister2Home = "/home/auyar/projects/temp";
String configPath = "/home/auyar/projects/temp/twister2-dist/conf/aurora";
Config config = ConfigLoader.loadConfig(twister2Home, configPath);
int size = config.size();
System.out.println("number of configs: " + size);
Set<String> keys = config.getKeySet();
for (String key : keys) {
System.out.println(key + ": " + config.get(key).toString());
}
}
use of edu.iu.dsc.tws.common.config.Config in project twister2 by DSC-SPIDAL.
the class LFSTest method main.
public static void main(String[] args) throws IOException {
Config config = Config.newBuilder().put(FsContext.UPLOAD_DIRECTORY, "/home/user/Desktop/test1/").build();
LocalFileSystemUploader lsf = new LocalFileSystemUploader();
lsf.initialize(config);
URI returned = lsf.uploadPackage("/home/user/Desktop/tobecopied/");
System.out.printf(returned.toString());
}
use of edu.iu.dsc.tws.common.config.Config in project twister2 by DSC-SPIDAL.
the class MPIProcess method loadConfigurations.
private static Config loadConfigurations(CommandLine cmd, int id) {
String twister2Home = cmd.getOptionValue("twister2_home");
String container = cmd.getOptionValue("container_class");
String configDir = cmd.getOptionValue("config_dir");
String clusterType = cmd.getOptionValue("cluster_type");
String jobName = cmd.getOptionValue("job_name");
LOG.log(Level.FINE, String.format("Initializing process with " + "twister_home: %s container_class: %s config_dir: %s cluster_type: %s", twister2Home, container, configDir, clusterType));
Config config = ConfigLoader.loadConfig(twister2Home, configDir + "/" + clusterType);
Config workerConfig = Config.newBuilder().putAll(config).put(MPIContext.TWISTER2_HOME.getKey(), twister2Home).put(MPIContext.CONTAINER_CLASS, container).put(MPIContext.TWISTER2_CONTAINER_ID, id).put(MPIContext.TWISTER2_CLUSTER_TYPE, clusterType).build();
String jobDescFile = JobUtils.getJobDescriptionFilePath(jobName, workerConfig);
JobAPI.Job job = JobUtils.readJobFile(null, jobDescFile);
Config updatedConfig = JobUtils.overrideConfigs(job, config);
updatedConfig = Config.newBuilder().putAll(updatedConfig).put(MPIContext.TWISTER2_HOME.getKey(), twister2Home).put(MPIContext.CONTAINER_CLASS, container).put(MPIContext.TWISTER2_CONTAINER_ID, id).put(MPIContext.TWISTER2_CLUSTER_TYPE, clusterType).build();
return updatedConfig;
}
use of edu.iu.dsc.tws.common.config.Config in project twister2 by DSC-SPIDAL.
the class TWSNetwork method loadConfig.
protected Config loadConfig(Config cfg) {
String networkConfigFile = CommunicationContext.networkConfigurationFile(cfg);
Config componentConfig = ConfigLoader.loadComponentConfig(networkConfigFile);
return Config.newBuilder().putAll(cfg).putAll(componentConfig).build();
}
Aggregations