title: How to programmatically get all running jobs in a Hadoop cluster using the new API?
body: <p>I have a software component which submits MR jobs to Hadoop. I now want to check if there are other jobs running before submitting it. I found out that there is a <code>Cluster</code> object in the new API which can be used to query the cluster for running jobs, get their configurations and extract the relevant information from them. However I am having problems using this.</p>
  
  <p>Just doing <code>new Cluster(conf)</code> where <code>conf</code> is a valid <code>Configuration</code> which can be used to access this cluster (e.g., to submit jobs to it) leaves the object unconfigured, and the <code>getAllJobStatuses()</code> method of <code>Cluster</code> returns <code>null</code>.</p>
  
  <p>Extracting <code>mapreduce.jobtracker.address</code> from the configuration, constructing an <code>InetSocketAddress</code> from it and using the other constructor of <code>Cluster</code> throws <code>Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses.</code>.</p>
  
  <p>Using the old api, doing something like <code>new JobClient(conf).getAllJobs()</code> throws an NPE.</p>
  
  <p>What am I missing here? How can I programmatically get the running jobs?</p>