List of usage examples for org.apache.hadoop.mapred JobConf setNumMapTasks
public void setNumMapTasks(int n)
From source file:gaffer.accumulostore.operation.hdfs.handler.job.factory.SampleDataForSplitPointsJobFactory.java
License:Apache License
protected void setupJobConf(final JobConf jobConf, final SampleDataForSplitPoints operation, final Store store) throws IOException { jobConf.set(SCHEMA, new String(store.getSchema().toJson(false), CommonConstants.UTF_8)); jobConf.set(MAPPER_GENERATOR, operation.getMapperGeneratorClassName()); jobConf.set(VALIDATE, String.valueOf(operation.isValidate())); jobConf.set(PROPORTION_TO_SAMPLE, String.valueOf(operation.getProportionToSample())); jobConf.set(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS, ((AccumuloStore) store).getKeyPackage().getKeyConverter().getClass().getName()); Integer numTasks = operation.getNumMapTasks(); if (null != numTasks) { jobConf.setNumMapTasks(numTasks); }/* ww w.ja v a 2 s .c o m*/ jobConf.setNumReduceTasks(1); }
From source file:gaffer.accumulostore.operation.hdfs.handler.job.SampleDataForSplitPointsJobFactory.java
License:Apache License
protected void setupJobConf(final JobConf jobConf, final SampleDataForSplitPoints operation, final Store store) throws IOException { jobConf.set(SCHEMA, new String(store.getSchema().toJson(false), CommonConstants.UTF_8)); jobConf.set(MAPPER_GENERATOR, operation.getMapperGeneratorClassName()); jobConf.set(VALIDATE, String.valueOf(operation.isValidate())); jobConf.set(PROPORTION_TO_SAMPLE, String.valueOf(operation.getProportionToSample())); Integer numTasks = operation.getNumMapTasks(); if (null != numTasks) { jobConf.setNumMapTasks(numTasks); }/*from ww w . j a v a 2 s . c o m*/ numTasks = operation.getNumReduceTasks(); if (null != numTasks) { jobConf.setNumReduceTasks(numTasks); } }
From source file:gaffer.operation.simple.hdfs.handler.AbstractAddElementsFromHdfsJobFactory.java
License:Apache License
protected void setupJobConf(final JobConf jobConf, final AddElementsFromHdfs operation, final Store store) throws IOException { jobConf.set(DATA_SCHEMA, new String(store.getDataSchema().toJson(false), UTF_8_CHARSET)); jobConf.set(STORE_SCHEMA, new String(store.getStoreSchema().toJson(false), UTF_8_CHARSET)); jobConf.set(MAPPER_GENERATOR, operation.getMapperGeneratorClassName()); jobConf.set(VALIDATE, String.valueOf(operation.isValidate())); Integer numTasks = operation.getNumMapTasks(); if (null != numTasks) { jobConf.setNumMapTasks(numTasks); }// www . j a v a2 s . co m numTasks = operation.getNumReduceTasks(); if (null != numTasks) { jobConf.setNumReduceTasks(numTasks); } }
From source file:gaffer.operation.simple.hdfs.handler.job.factory.AbstractAddElementsFromHdfsJobFactory.java
License:Apache License
protected void setupJobConf(final JobConf jobConf, final AddElementsFromHdfs operation, final Store store) throws IOException { LOGGER.info("Setting up job conf"); jobConf.set(SCHEMA, new String(store.getSchema().toJson(false), CommonConstants.UTF_8)); LOGGER.info("Added {} {} to job conf", SCHEMA, new String(store.getSchema().toJson(false), CommonConstants.UTF_8)); jobConf.set(MAPPER_GENERATOR, operation.getMapperGeneratorClassName()); LOGGER.info("Added {} of {} to job conf", MAPPER_GENERATOR, operation.getMapperGeneratorClassName()); jobConf.set(VALIDATE, String.valueOf(operation.isValidate())); LOGGER.info("Added {} option of {} to job conf", VALIDATE, operation.isValidate()); Integer numTasks = operation.getNumMapTasks(); if (null != numTasks) { jobConf.setNumMapTasks(numTasks); LOGGER.info("Set number of map tasks to {} on job conf", numTasks); }// w w w.j a v a 2s .c o m numTasks = operation.getNumReduceTasks(); if (null != numTasks) { jobConf.setNumReduceTasks(numTasks); LOGGER.info("Set number of reduce tasks to {} on job conf", numTasks); } }
From source file:gov.nasa.jpl.memex.pooledtimeseries.MeanChiSquareDistanceCalculation.java
License:Apache License
public static void main(String[] args) throws Exception { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Configuration baseConf = new Configuration(); baseConf.set("mapreduce.job.maps", "96"); baseConf.set("mapred.tasktracker.map.tasks.maximum", "96"); JobConf conf = new JobConf(); System.out.println("Before Map:" + conf.getNumMapTasks()); conf.setNumMapTasks(96); System.out.println("After Map:" + conf.getNumMapTasks()); Job job = Job.getInstance(baseConf); job.setJarByClass(MeanChiSquareDistanceCalculation.class); job.setJobName("mean_chi_square_calculation"); System.out.println("Job ID" + job.getJobID()); System.out.println("Track:" + baseConf.get("mapred.job.tracker")); System.out.println("Job Name" + job.getJobName()); System.out.println(baseConf.get("mapreduce.job.maps")); System.out.println("Caching video-metric-bak.tgz"); job.addCacheArchive(new URI("/user/pts/video-metric-bak.tgz")); URI[] cacheFiles = job.getCacheFiles(); if (cacheFiles != null && cacheFiles.length > 0) { System.out.println("Cache file ->" + cacheFiles[0]); }//w ww .java 2s .co m System.out.println("Cached video-metric-bak.tgz"); job.setMapOutputKeyClass(IntWritable.class); job.setMapOutputValueClass(DoubleWritable.class); job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(DoubleWritable.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.waitForCompletion(true); }
From source file:gov.nasa.jpl.memex.pooledtimeseries.SimilarityCalculation.java
License:Apache License
public static void main(String[] args) throws Exception { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Configuration baseConf = new Configuration(); baseConf.set("mapreduce.job.maps", "96"); baseConf.set("mapreduce.job.reduces", "0"); baseConf.set("mapred.tasktracker.map.tasks.maximum", "96"); baseConf.set("meanDistsFilePath", args[2]); JobConf conf = new JobConf(); System.out.println("Before Map:" + conf.getNumMapTasks()); conf.setNumMapTasks(196); System.out.println("After Map:" + conf.getNumMapTasks()); Job job = Job.getInstance(baseConf); System.out.println("Track: " + baseConf.get("mapred.job.tracker")); System.out.println("Job ID" + job.getJobID()); System.out.println("Job Name" + job.getJobName()); System.out.println(baseConf.get("mapreduce.job.maps")); job.setJarByClass(SimilarityCalculation.class); job.setJobName("similarity_calc"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(Map.class); job.waitForCompletion(true);/* ww w. java 2s . co m*/ }
From source file:gov.nih.ncgc.hadoop.SmartsSearch.java
public int run(String[] args) throws Exception { JobConf jobConf = new JobConf(getConf(), HeavyAtomCount.class); jobConf.setJobName("smartsSearch"); jobConf.setOutputKeyClass(Text.class); jobConf.setOutputValueClass(IntWritable.class); jobConf.setMapperClass(MoleculeMapper.class); jobConf.setCombinerClass(SmartsMatchReducer.class); jobConf.setReducerClass(SmartsMatchReducer.class); jobConf.setInputFormat(TextInputFormat.class); jobConf.setOutputFormat(TextOutputFormat.class); jobConf.setNumMapTasks(5); if (args.length != 4) { System.err.println("Usage: ss <in> <out> <pattern> <license file>"); System.exit(2);/* w ww . jav a 2s.co m*/ } FileInputFormat.setInputPaths(jobConf, new Path(args[0])); FileOutputFormat.setOutputPath(jobConf, new Path(args[1])); jobConf.setStrings("pattern", args[2]); // make the license file available vis dist cache DistributedCache.addCacheFile(new Path(args[3]).toUri(), jobConf); JobClient.runJob(jobConf); return 0; }
From source file:hadoop.UIUCWikifierAppHadoop.java
@Override public int run(String[] args) throws Exception { Configuration conf = getConf(); JobConf job = new JobConf(conf, UIUCWikifierAppHadoop.class); // System.out.println("Run.. Envinronment Variables"); // java.util.Map<String,String> env = System.getenv(); ///*from ww w .j a v a2 s . c o m*/ // System.out.println("Printing environment variables"); // for(String k : env.keySet()){ // System.out.println(k + "\t" + env.get(k)); // } // String jlpValue = System.getProperty("java.library.path"); // System.out.println("java.library.path=" + jlpValue); // System.setProperty("java.library.path", jlpValue + ":" + "/home/jgilme1/bin/gurobi550/linux64/lib"); //process command line options Path in = new Path(args[0]); Path out = new Path(args[1]); //change current working directory to hdfs path.. job.setJobName("entitylinker"); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setInputFormat(DistributeInputFormat.class); job.setOutputFormat(TextOutputFormat.class); job.setMapperClass(Map.class); FileInputFormat.setInputPaths(job, in); FileOutputFormat.setOutputPath(job, out); job.setNumReduceTasks(0); job.setNumMapTasks(Integer.parseInt(args[2])); job.set("mapreduce.input.fileinputformat.split.minsize", "0"); job.set("mapred.child.java.opts", "-Xmx16g"); job.setNumTasksToExecutePerJvm(-1); //job.setMemoryForMapTask(new Long(12288)); //job.set(JobConf.MAPRED_MAP_TASK_ULIMIT, "12582912"); String gurobiHomeVariable = "GUROBI_HOME"; String gurobiHomeValue = "/home/jgilme1/bin/gurobi560/linux64"; String pathVariable = "PATH"; String newPathValue = gurobiHomeValue + "/bin"; String ldLibraryPathVariable = "LD_LIBRARY_PATH"; String ldLibraryPathValue = gurobiHomeValue + "/lib"; String grbLicenseFileVariable = "GRB_LICENSE_FILE"; String grbLicenseFileValue = "/scratch6/usr/jgilme1/gurobiLicense/gurobi.lic"; StringBuilder newEnvironment = new StringBuilder(); newEnvironment.append(gurobiHomeVariable); newEnvironment.append("="); newEnvironment.append(gurobiHomeValue); newEnvironment.append(","); newEnvironment.append(pathVariable); newEnvironment.append("="); newEnvironment.append("$" + pathVariable + ":"); newEnvironment.append(newPathValue); newEnvironment.append(","); newEnvironment.append(ldLibraryPathVariable); newEnvironment.append("=$" + ldLibraryPathVariable + ":"); newEnvironment.append(ldLibraryPathValue); newEnvironment.append(","); newEnvironment.append(grbLicenseFileVariable); newEnvironment.append("="); newEnvironment.append(grbLicenseFileValue); //System.out.println(newEnvironment.toString()); job.set(JobConf.MAPRED_MAP_TASK_ENV, newEnvironment.toString()); DistributedCache.addCacheArchive(new URI("/user/jgilme1/entitylinking/Wikifier2013.tar.gz"), job); JobClient.runJob(job); return 0; }
From source file:infinidb.hadoop.example.InfiniDBOutputDriver.java
License:Apache License
public int run(String[] args) throws Exception { Configuration conf = new Configuration(); JobConf jobconf = new JobConf(conf, InfiniDoopDriver.class); DBConfiguration.configureDB(jobconf, "com.mysql.jdbc.Driver", "jdbc:mysql://srvswint4/tpch1", "root", ""); String[] fields = { "n_nationkey", "n_name" }; String[] outFields = { "id", "name" }; jobconf.setInputFormat(IDBFileInputFormat.class); jobconf.setOutputFormat(InfiniDBOutputFormat.class); jobconf.setOutputKeyClass(NullWritable.class); jobconf.setOutputValueClass(Text.class); InfiniDBOutputFormat.setOutput(jobconf, "db", outFields); InfiniDBConfiguration idbconf = new InfiniDBConfiguration(jobconf); idbconf.setInputPath("input"); idbconf.setOutputPath("output"); idbconf.setInfiniDBHome("/usr/local/Calpont"); jobconf.setMapperClass(InfiniDoopMapper.class); jobconf.setNumMapTasks(1); jobconf.setNumReduceTasks(2);/*w w w. j a v a 2 s .co m*/ JobClient client = new JobClient(); client.setConf(jobconf); try { JobClient.runJob(jobconf); } catch (Exception e) { e.printStackTrace(); } return 0; }
From source file:infinidb.hadoop.example.InfiniDoopDriver.java
License:Apache License
public int run(String[] args) throws Exception { Configuration conf = new Configuration(); JobConf jobconf = new JobConf(conf, InfiniDoopDriver.class); DBConfiguration.configureDB(jobconf, "com.mysql.jdbc.Driver", "jdbc:mysql://srvswint4/tpch1", "root", ""); String[] fields = { "n_nationkey", "n_name" }; jobconf.setInputFormat(InfiniDBInputFormat.class); jobconf.setOutputKeyClass(LongWritable.class); jobconf.setOutputValueClass(Text.class); InfiniDBInputFormat.setInput(jobconf, InfiniDoopRecord.class, "nation", null, "n_nationkey", fields); InfiniDBConfiguration idbconf = new InfiniDBConfiguration(jobconf); idbconf.setOutputPath("output2"); jobconf.setMapperClass(InfiniDoopInputMapper.class); jobconf.setNumMapTasks(4); jobconf.setNumReduceTasks(1);//from www .ja v a 2s . c o m jobconf.set("mapred.textoutputformat.separator", "|"); JobClient client = new JobClient(); client.setConf(jobconf); try { JobClient.runJob(jobconf); } catch (Exception e) { e.printStackTrace(); } return 0; }