You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Some Body <so...@squareplanet.de> on 2010/06/17 14:53:51 UTC

how to query JobTracker

Hi All,

What are the steps to query the cluster for running jobs with a particular JobName?
My driver class always submits my job with a preset name.
    Job job = new Job(config, "My Job Name");
    ......
    return job.waitForCompletion(true) ? 0 : 1;

I want to setup a cron to trigger the job submission and I want to ensure only 1 instance of my job is running.
Surely I could do this via a shell wrapper, but I'd rather implement it in my driver class. 
i.e. getAllJobs from the JobTracker, check for "My Job Name", and kill the old job before submitting a new job.

I'm using (cloudera's) hadoop 0.20.2+228

Thanks,
Alan

Re: how to query JobTracker

Posted by Jeff Zhang <zj...@gmail.com>.
Use JobClient.submitJob(JobConf job) , this method will return
RunningJob. Then you can call RunningJob.isComplete() to query whether
the previous job has been done.



On Thu, Jun 17, 2010 at 5:53 AM, Some Body <so...@squareplanet.de> wrote:
> Hi All,
>
> What are the steps to query the cluster for running jobs with a particular JobName?
> My driver class always submits my job with a preset name.
>    Job job = new Job(config, "My Job Name");
>    ......
>    return job.waitForCompletion(true) ? 0 : 1;
>
> I want to setup a cron to trigger the job submission and I want to ensure only 1 instance of my job is running.
> Surely I could do this via a shell wrapper, but I'd rather implement it in my driver class.
> i.e. getAllJobs from the JobTracker, check for "My Job Name", and kill the old job before submitting a new job.
>
> I'm using (cloudera's) hadoop 0.20.2+228
>
> Thanks,
> Alan
>



-- 
Best Regards

Jeff Zhang

Re: how to query JobTracker

Posted by Sanel Zukan <sa...@gmail.com>.
AFAIK, there is no such method (to get a job name from client side) :(
 (at least I wasn't able to find it). Via JobProfile can be
extracted job name via given id, but only JobTracker can access it (if
you try to instantiate it, you will start own job tracker).

The only solution is to directly query things via job id, received
when job was started.

On Thu, Jun 17, 2010 at 2:53 PM, Some Body <so...@squareplanet.de> wrote:
> Hi All,
>
> What are the steps to query the cluster for running jobs with a particular JobName?
> My driver class always submits my job with a preset name.
>    Job job = new Job(config, "My Job Name");
>    ......
>    return job.waitForCompletion(true) ? 0 : 1;
>
> I want to setup a cron to trigger the job submission and I want to ensure only 1 instance of my job is running.
> Surely I could do this via a shell wrapper, but I'd rather implement it in my driver class.
> i.e. getAllJobs from the JobTracker, check for "My Job Name", and kill the old job before submitting a new job.
>
> I'm using (cloudera's) hadoop 0.20.2+228
>
> Thanks,
> Alan
>