Github user kayousterhout commented on a diff in the pull request:

    https://github.com/apache/spark/pull/900#discussion_r14036842
  
    --- Diff: 
yarn/common/src/main/scala/org/apache/spark/scheduler/cluster/YarnClusterSchedulerBackend.scala
 ---
    @@ -0,0 +1,51 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.scheduler.cluster
    +
    +
    +import org.apache.spark.{Logging, SparkContext}
    +import org.apache.spark.deploy.yarn.ApplicationMasterArguments
    +import org.apache.spark.scheduler.TaskSchedulerImpl
    +
    +import scala.collection.mutable.ArrayBuffer
    +
    +private[spark] class YarnClusterSchedulerBackend(
    +    scheduler: TaskSchedulerImpl,
    +    sc: SparkContext)
    +  extends CoarseGrainedSchedulerBackend(scheduler, sc.env.actorSystem)
    +  with Logging {
    +
    +  private[spark] def addArg(optionName: String, envVar: String, sysProp: 
String,
    +      arrayBuf: ArrayBuffer[String]) {
    +    if (System.getenv(envVar) != null) {
    +      arrayBuf += (optionName, System.getenv(envVar))
    +    } else if (sc.getConf.contains(sysProp)) {
    +      arrayBuf += (optionName, sc.getConf.get(sysProp))
    +    }
    +  }
    +
    +  override def start() {
    +    super.start()
    +    val argsArrayBuf = new ArrayBuffer[String]()
    +    List(("--num-executors", "SPARK_EXECUTOR_INSTANCES", 
"spark.executor.instances"),
    +      ("--num-executors", "SPARK_WORKER_INSTANCES", 
"spark.worker.instances"))
    +      .foreach { case (optName, envVar, sysProp) => addArg(optName, 
envVar, sysProp, argsArrayBuf) }
    +    val args = new ApplicationMasterArguments(argsArrayBuf.toArray)
    +    totalExecutors.set(args.numExecutors)
    --- End diff --
    
    Ah I see -- I was confused by this 
http://spark.apache.org/docs/latest/spark-standalone.html -- since standalone 
mode interprets SPARK_WORKER_INSTANCES differently.  Sorry for the confusion!
    
    My other question here was about the ApplicationMaterArguments here -- does 
that actually get used, or is it just constructed as a way to get numExecutors?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to