Examples of JobClient


Examples of org.apache.hadoop.mapred.JobClient

    Job job = new Job(jobconf);
    jobconf.set("mapred.output.dir", "output1");
        jobconf.setMapperClass(InfiniDoopInputMapper.class);
        jobconf.setNumMapTasks(4);
        jobconf.setNumReduceTasks(8);
        JobClient client = new JobClient();
        //System.out.println(jobconf.getUser());
        //System.out.println(FileOutputFormat.getOutputPath(jobconf));

        //int i = (job.waitForCompletion(true)? 1: 0);
        //return i;
        client.setConf(jobconf);
    try {
      JobClient.runJob(jobconf);
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

    jobconf.set("mapred.output.dir", "output");
   
        jobconf.setMapperClass(InfiniDoopMapper.class);
        jobconf.setNumMapTasks(1);
        jobconf.setNumReduceTasks(2);
        JobClient client = new JobClient();
        //System.out.println(jobconf.getUser());
        //System.out.println(FileOutputFormat.getOutputPath(jobconf));
        jobconf.setInt("mapred.min.split.size", 2147483647);

        //int i = (job.waitForCompletion(true)? 1: 0);
        //return i;
        client.setConf(jobconf);
    try {
      JobClient.runJob(jobconf);
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

    sortJob.setOutputKeyComparatorClass           // sort by decreasing freq
      (LongWritable.DecreasingComparator.class);

    JobClient.runJob(sortJob);

    new JobClient(defaults).getFs().delete(tempDir);
  }
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

  protected void closeFileSystem(FileSystem fs) throws IOException {
    fs.close();
  }

  protected JobClient createJobClient(JobConf jobtrackerConf) throws IOException {
    return new JobClient(jobtrackerConf);
  }
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

      UserGroupInformation ugi = getUGI(user);
      return ugi.doAs(new PrivilegedExceptionAction<T>() {
        public T run() throws Exception {
          JobConf jobtrackerConf = createJobTrackerConf(conf);
          Configuration namenodeConf = createNameNodeConf(conf);
          JobClient jobClient = createJobClient(jobtrackerConf);
          try {
            checkJobTrackerHealth(jobClient);
            FileSystem fs = createFileSystem(namenodeConf);
            Instrumentation instrumentation = getServer().get(Instrumentation.class);
            Instrumentation.Cron cron = instrumentation.createCron();
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    final JobClient jca[] = new JobClient[1];
    final FileSystem fsa[] = new FileSystem[1];

    hadoop.execute("u", getHadoopConf(), new Hadoop.JobClientExecutor<Void>() {
      @Override
      public Void execute(JobClient jc, FileSystem fs) throws IOException {
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    final JobClient jca[] = new JobClient[1];
    final FileSystem fsa[] = new FileSystem[1];

    try {
      hadoop.execute("u", getHadoopConf(), new Hadoop.JobClientExecutor<Void>() {
        @Override
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

    FileSystem fs = FileSystem.get(conf);
    Assert.assertNotNull(fs);
    Assert.assertEquals(fs.getUri().getScheme(), "hdfs");
    Assert.assertTrue(fs.exists(getHadoopTestDir()));
    fs.close();
    JobClient jobClient = new JobClient(conf);
    Assert.assertNotNull(jobClient);
    jobClient.close();
  }
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

  @Test
  @TestHadoop
  public void testHadoopMapReduce() throws Exception {
    JobConf conf = getHadoopConf();
    FileSystem fs = FileSystem.get(conf);
    JobClient jobClient = new JobClient(conf);
    try {
      Path inputDir = new Path(getHadoopTestDir(), "input");
      Path outputDir = new Path(getHadoopTestDir(), "output");

      fs.mkdirs(inputDir);
      Writer writer = new OutputStreamWriter(fs.create(new Path(inputDir, "data.txt")));
      writer.write("a\n");
      writer.write("b\n");
      writer.write("c\n");
      writer.close();

      JobConf jobConf = getHadoopConf();
      jobConf.setInt("mapred.map.tasks", 1);
      jobConf.setInt("mapred.map.max.attempts", 1);
      jobConf.setInt("mapred.reduce.max.attempts", 1);
      jobConf.set("mapred.input.dir", inputDir.toString());
      jobConf.set("mapred.output.dir", outputDir.toString());
      final RunningJob runningJob = jobClient.submitJob(jobConf);
      waitFor(60 * 1000, true, new Predicate() {
        @Override
        public boolean evaluate() throws Exception {
          return runningJob.isComplete();
        }
      });
      Assert.assertTrue(runningJob.isSuccessful());
      Assert.assertTrue(fs.exists(new Path(outputDir, "part-00000")));
      BufferedReader reader =
        new BufferedReader(new InputStreamReader(fs.open(new Path(outputDir, "part-00000"))));
      Assert.assertTrue(reader.readLine().trim().endsWith("a"));
      Assert.assertTrue(reader.readLine().trim().endsWith("b"));
      Assert.assertTrue(reader.readLine().trim().endsWith("c"));
      Assert.assertNull(reader.readLine());
      reader.close();
    }
    finally {
      fs.close();
      jobClient.close();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.mapred.JobClient

    final Configuration conf, int pollingInterval, CountDownLatch startFlag)
    throws IOException, InterruptedException {
    UserGroupInformation ugi = UserGroupInformation.getLoginUser();
      this.cluster = ugi.doAs(new PrivilegedExceptionAction<JobClient>(){
        public JobClient run() throws IOException {
          return new JobClient(new JobConf(conf));
        }
      });

    this.jtPollingInterval = pollingInterval;
    maxJobCompletedInInterval = conf.getInt(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.