hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Some Body" <someb...@squareplanet.de>
Subject new/old APIs
Date Mon, 21 Jun 2010 13:30:37 GMT
I still haven't figured out how to query the JobTracker for a specific running job using the
new API.
Is this at all possible? The old/new APIs are driving me crazy.
    
As far as I understand the old API entailed using mapred.JobClient & JobConf

  JobConf jobConf = new JobConf(new Configuration(), MyJob.class);
  ....
  RunningJob runningJob = JobClient.submitJob(jobConf);

But in the new API I'm using mapreduce.Job like this:

  130: Job job = new Job(new Configuration(), "MyJobName");
  131: job.submit();
  132: // The job starts ok here but the job.getJobID() gives me a null pointer.
  133: System.err.printf("submitted job %s\n", job.getJobID().toString());

After submitting the job with job.submit() above I can do this to get all jobs,

  100: JobConf jobConf = new JobConf(config, MyDriver.class);
  101: JobClient jc = new JobClient(jobConf);
  102: JobStatus[] allJobs = jc.getAllJobs();
  103: for (int i = 0; i<allJobs.length; i++) {
  104:   // check running jobs
  105:   int status = allJobs[i].getRunState(); 
  106:     if ( status == 1 ) {
  107:       JobID jid = allJobs[i].getJobID();
  108:       // compare this id or name to the id/name from my lock file
  109:       System.err.printf("job %s is still running\n", jid.toString());
  110:     }
  111: }

but I still need a way to retrieve the job's ID or name after line 131 above,
because I'd be writing this ID (or name) to a lock file and then killing the
job in the loop before starting a new job.

Thanks,
Alan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message