You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/26 02:35:44 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #35023: [SPARK-37709][K8S][FOLLOWUP] Avoid diving by zero

dongjoon-hyun commented on a change in pull request #35023:
URL: https://github.com/apache/spark/pull/35023#discussion_r775188278



##########
File path: resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorRollPlugin.scala
##########
@@ -108,7 +108,7 @@ class ExecutorRollDriverPlugin extends DriverPlugin with Logging {
       case ExecutorRollPolicy.TOTAL_DURATION =>
         listWithoutDriver.sortBy(_.totalDuration).reverse
       case ExecutorRollPolicy.AVERAGE_DURATION =>
-        listWithoutDriver.sortBy(e => e.totalDuration.toFloat / e.totalTasks).reverse
+        listWithoutDriver.sortBy(e => e.totalDuration.toFloat / Math.max(1, e.totalTasks)).reverse

Review comment:
       Nice catch!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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