title: How do I limit the number of spark applications in state=RUNNING to 1 for a single queue in YARN?
body: <p>I have multiple spark jobs.  Normally I submit my spark jobs to yarn and I have an option that is <code>--yarn_queue</code> which tells it which yarn queue to enter.  </p>
  
  <p>But, the jobs seem to run in parallel in the same queue.  Sometimes, the results of one spark job, are the inputs for the next spark job.  How do I run my spark jobs sequentially rather than in parallel in the same queue?  </p>
  
  <p>I have looked at <a href="http://hadoop.apache.org/docs/r2.4.1/hadoop-yarn/hadoop-yarn-site/CapacityScheduler.html" rel="nofollow noreferrer">this</a> page for a capacity scheduler.  But the closest thing I can see is the property <code>yarn.scheduler.capacity.&lt;queue&gt;.maximum-applications</code>.  But this only sets the number of applications that can be in both PENDING and RUNNING.  I'm interested in setting the number of applications that can be in the RUNNING state, but I don't care the total number of applications in PENDING (or ACCEPTED which is the same thing).</p>
  
  <p>How do I limit the number of applications in state=RUNNING to 1 for a single queue?</p>