You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by wi...@apache.org on 2024/07/12 08:20:41 UTC

(yunikorn-k8shim) branch master updated: [YUNIKORN-2738] Only check failure reason once when failing app (#877)

This is an automated email from the ASF dual-hosted git repository.

wilfreds pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new c6f69b7b [YUNIKORN-2738] Only check failure reason once when failing app (#877)
c6f69b7b is described below

commit c6f69b7bd8b6b6914807b9f27ef54466b2bb1f97
Author: Wilfred Spiegelenburg <wi...@apache.org>
AuthorDate: Fri Jul 12 18:20:24 2024 +1000

    [YUNIKORN-2738] Only check failure reason once when failing app (#877)
    
    Optimisation in failure type determination by moving it outside the
    loop.
    
    Closes: #877
    
    Signed-off-by: Wilfred Spiegelenburg <wi...@apache.org>
---
 pkg/cache/application.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pkg/cache/application.go b/pkg/cache/application.go
index 9833a6f2..3bedb132 100644
--- a/pkg/cache/application.go
+++ b/pkg/cache/application.go
@@ -615,12 +615,14 @@ func (app *Application) handleFailApplicationEvent(errMsg string) {
 	unalloc = append(unalloc, app.getTasks(TaskStates().Pending)...)
 	unalloc = append(unalloc, app.getTasks(TaskStates().Scheduling)...)
 
+	timeout := strings.Contains(errMsg, constants.ApplicationInsufficientResourcesFailure)
+	rejected := strings.Contains(errMsg, constants.ApplicationRejectedFailure)
 	// publish pod level event to unallocated pods
 	for _, task := range unalloc {
 		// Only need to fail the non-placeholder pod(s)
-		if strings.Contains(errMsg, constants.ApplicationInsufficientResourcesFailure) {
+		if timeout {
 			failTaskPodWithReasonAndMsg(task, constants.ApplicationInsufficientResourcesFailure, "Scheduling has timed out due to insufficient resources")
-		} else if strings.Contains(errMsg, constants.ApplicationRejectedFailure) {
+		} else if rejected {
 			errMsgArr := strings.Split(errMsg, ":")
 			failTaskPodWithReasonAndMsg(task, constants.ApplicationRejectedFailure, errMsgArr[1])
 		}


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org