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 01:11:03 UTC

[GitHub] [spark] williamhyun opened a new pull request #35023: [SPARK-37709][K8S][FOLLOWUP] Avoid diving by zero

williamhyun opened a new pull request #35023:
URL: https://github.com/apache/spark/pull/35023


   ### What changes were proposed in this pull request?
   This PR aims to avoid diving by zero
   
   
   ### Why are the changes needed?
   To prevent potential exceptions. 
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   
   ### How was this patch tested?
   Pass the CIs. 


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


[GitHub] [spark] dongjoon-hyun closed pull request #35023: [SPARK-37709][K8S][FOLLOWUP] Avoid diving by zero

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun closed pull request #35023:
URL: https://github.com/apache/spark/pull/35023


   


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


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

Posted by GitBox <gi...@apache.org>.
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