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

Reply via email to