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

    https://github.com/apache/spark/pull/5563#discussion_r33276076
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosSchedulerBackend.scala
 ---
    @@ -191,13 +194,24 @@ private[spark] class MesosSchedulerBackend(
             val mem = getResource(o.getResourcesList, "mem")
             val cpus = getResource(o.getResourcesList, "cpus")
             val slaveId = o.getSlaveId.getValue
    -        (mem >= MemoryUtils.calculateTotalMemory(sc) &&
    -          // need at least 1 for executor, 1 for task
    -          cpus >= (mesosExecutorCores + scheduler.CPUS_PER_TASK)) ||
    -          (slaveIdsWithExecutors.contains(slaveId) &&
    -            cpus >= scheduler.CPUS_PER_TASK)
    +        val offerAttributes = (o.getAttributesList map getAttribute).toMap
    +
    +        // check if all constraints are satisfield
    +        //  1. Attribute constraints
    +        //  2. Memory requirements
    +        //  3. CPU requirements
    +        val meetsConstrains = 
matchesAttributeRequirements(slaveOfferConstraints, offerAttributes)
    +        val meetsMemoryRequirements = mem >= calculateTotalMemory(sc)
    +        val meetsCPURequirements = cpus >= (mesosExecutorCores + 
scheduler.CPUS_PER_TASK)
    +
    +        // need at least 1 for executor, 1 for task
    --- End diff --
    
    nit: I think this comment is meant to go with `meetsCPURequirements`, right?


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to