title: Spark job with explicit setMaster("local"), passed to spark-submit with YARN
body: <p>If I have a Spark job (2.2.0) compiled with <code>setMaster("local")</code> what will happen if I send that job with <code>spark-submit --master yarn --deploy-mode cluster</code> ?</p>
  
  <p>I tried this and it looked like the job did get packaged up and executed on the YARN cluster rather than locally.  </p>
  
  <p>What I'm not clear on:</p>
  
  <ul>
  <li><p>why does this work?  According to the docs, things that you set in <code>SparkConf</code> explicitly have precedence over things passed in from the command line or via <code>spark-submit</code> (see: <a href="https://spark.apache.org/docs/latest/configuration.html" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/configuration.html</a>).  Is this different because I'm using <code>SparkSession.getBuilder</code>?</p></li>
  <li><p>is there any less obvious impact of leaving <code>setMaster("local")</code> in code vs. removing it?  I'm wondering if what I'm seeing is something like the job running in local mode, within the cluster, rather than properly using cluster resources. </p></li>
  </ul>