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

    https://github.com/apache/spark/pull/8653#discussion_r39019047
  
    --- Diff: 
core/src/test/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerBackendSuite.scala
 ---
    @@ -42,6 +42,38 @@ import org.apache.spark.{LocalSparkContext, SparkConf, 
SparkContext, SparkFunSui
     
     class MesosSchedulerBackendSuite extends SparkFunSuite with 
LocalSparkContext with MockitoSugar {
     
    +  test("Use configured mesosExecutor.cores for ExecutorInfo") {
    +    val mesosExecutorCores = 3
    +    val conf = new SparkConf
    +    conf.set("spark.mesos.mesosExecutor.cores", 
mesosExecutorCores.toString)
    +
    +    val listenerBus = mock[LiveListenerBus]
    +    listenerBus.post(
    +      SparkListenerExecutorAdded(anyLong, "s1", new ExecutorInfo("host1", 
2, Map.empty)))
    +
    +    val sc = mock[SparkContext]
    +    when(sc.getSparkHome()).thenReturn(Option("/spark-home"))
    +
    +    when(sc.conf).thenReturn(conf)
    +    when(sc.executorEnvs).thenReturn(new mutable.HashMap[String, String])
    +    when(sc.executorMemory).thenReturn(100)
    +    when(sc.listenerBus).thenReturn(listenerBus)
    +    val taskScheduler = mock[TaskSchedulerImpl]
    +    when(taskScheduler.CPUS_PER_TASK).thenReturn(2)
    +
    +    val mesosSchedulerBackend = new MesosSchedulerBackend(taskScheduler, 
sc, "master")
    +
    +    val resources = Arrays.asList(
    +      mesosSchedulerBackend.createResource("cpus", 4),
    +      mesosSchedulerBackend.createResource("mem", 1024))
    +    // uri is null.
    +    val (executorInfo, _) = 
mesosSchedulerBackend.createExecutorInfo(resources, "test-id")
    +    val executorResources = executorInfo.getResourcesList
    +    val cpus = executorResources.asScala.find(_.getName == 
"cpus").get.getScalar.getValue
    --- End diff --
    
    I don't think it's really preferred, it's just how it's written in the 
first place. I suggest if you think it makes sense either keep it for now or 
change it everywhere else.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to