Skip to content

Commit

Permalink
Round up the number of allowed instances when using max_per_relative
Browse files Browse the repository at this point in the history
Otherwise, it fails when number of target instances is low
  • Loading branch information
Lqp1 committed Jan 11, 2022
1 parent 5286f8b commit 9e3065b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/mesosphere/mesos/Constraints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ object Constraints extends StrictLogging {
private def checkMaxPerRelative(offerValue: String, maxRelative: Double, groupFunc: (Placed) => Option[String]): Boolean = {
// Group tasks by the constraint value, and calculate the task count of each group
val groupedTasks = allPlaced.groupBy(groupFunc).map { case (k, v) => k -> v.size }
val maxCount = (maxRelative * targetInstanceCount).toInt
val maxCount = (maxRelative * targetInstanceCount).ceil.toInt
groupedTasks.find(_._1.contains(offerValue)).forall(_._2 < maxCount)
}

Expand Down

0 comments on commit 9e3065b

Please sign in to comment.