Package org.apache.hadoop.mapred

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


    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

    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

    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

  @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

    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

  @Override
  public synchronized void connect() throws IOException {
    if (isConnected()) {
      return;
    }
    client = new JobClient(new JobConf(getConf()));
    setConnected(true);
  }
View Full Code Here

    }
    conf.set(DST_DIR_LABEL, outputPath.toString());
    final String randomId = DistCp.getRandomId();
    Path stagingArea;
    try {
      stagingArea = JobSubmissionFiles.getStagingDir(new JobClient(conf),
            conf);
    } catch (InterruptedException e) {
      throw new IOException(e);
    }
    Path jobDirectory = new Path(stagingArea,
View Full Code Here

    for (String propertyKey : properties.keySet())
      conf.set(propertyKey, properties.get(propertyKey));

    configJob(conf);

    JobClient c = new JobClient(conf);
    RunningJob job = c.runJob(conf);
    return job.isSuccessful();
  }
View Full Code Here

      File wd = new File(".").getAbsoluteFile();
      StreamUtil.unJar(new File(jar_), wd);
    }

    // if jobConf_ changes must recreate a JobClient
    jc_ = new JobClient(jobConf_);
    boolean error = true;
    running_ = null;
    String lastReport = null;
    try {
      running_ = jc_.submitJob(jobConf_);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.mapred.JobClient

Copyright © 2018 www.massapicom. 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.