How to get applicationId of Spark application deployed to YARN in Scala?
<p>I'm using the following Scala code (as a custom <code>spark-submit</code> wrapper) to submit a Spark application to a YARN cluster:</p>

<pre><code>val result = Seq(spark_submit_script_here).!!
</code></pre>

<p>All I have at the time of submission is <code>spark-submit</code> and the Spark application's jar (no SparkContext). I'd like to capture <code>applicationId</code> from <code>result</code>, but it's empty.</p>

<p>I can see in my command line output the applicationId and rest of the Yarn messages:</p>

<blockquote>
  <p>INFO yarn.Client: Application report for application_1450268755662_0110</p>
</blockquote>

<p>How can I read it within code and get the applicationId ?</p>