@@ -190,6 +190,7 @@ func ReceiveJob(c *gin.Context) {
190190 }
191191
192192 if ! available {
193+ NewJobService ().UpdateJobEntityStatusByJobUuid (jobEntity .JobUuid , models .JOB_REJECTED_STATUS )
193194 logs .GetLogger ().Warnf ("job_uuid: %s, name: %s, msg: %s" , jobData .UUID , jobData .Name , strings .Join (noAvailableMsgs , ";" ))
194195 c .JSON (http .StatusInternalServerError , util .CreateErrorResponse (util .NoAvailableResourcesError , strings .Join (noAvailableMsgs , ";" )))
195196 return
@@ -1585,8 +1586,9 @@ func checkResourceAvailableForSpace(jobUuid string, jobType int, resourceConfig
15851586 FreeIndex []string
15861587 }
15871588
1588- var noAvailableStr [] string
1589+ var noAvailableStrMap = make ( map [ string ][] string )
15891590 for _ , node := range nodes .Items {
1591+ var noAvailableStr []string
15901592 var nodeName = node .Name
15911593 var nodeGpuInfo = nodeGpuSummary [nodeName ]
15921594 nodeGpu , remainderResource , _ := GetNodeResource (activePods , & node )
@@ -1619,6 +1621,7 @@ func checkResourceAvailableForSpace(jobUuid string, jobType int, resourceConfig
16191621 if len (noAvailableStr ) == 0 {
16201622 return true , "" , nil , 0 , nil , nil
16211623 } else {
1624+ noAvailableStrMap [nodeName ] = noAvailableStr
16221625 logs .GetLogger ().Warnf ("the job_uuid: %s is not available for this node=%s resource. Reason: %s" ,
16231626 jobUuid , node .Name , strings .Join (noAvailableStr , ";" ))
16241627 }
@@ -1632,16 +1635,14 @@ func checkResourceAvailableForSpace(jobUuid string, jobType int, resourceConfig
16321635 if int64 (len (remainingGpu )) < gpuNum {
16331636 noAvailableStr = append (noAvailableStr , fmt .Sprintf ("gpu need name:%s, num:%d, remainder: %d" , hardwareDetail .Gpu .Unit , hardwareDetail .Gpu .Quantity , len (remainingGpu )))
16341637 }
1635-
16361638 if len (noAvailableStr ) == 0 {
16371639 return true , gpuName , remainingGpu , gpuNum , nil , nil
1638- } else {
1639- logs .GetLogger ().Warnf ("the job_uuid: %s is not available for this node=%s resource. Reason: %s" ,
1640- jobUuid , node .Name , strings .Join (noAvailableStr , ";" ))
16411640 }
16421641 }
16431642 }
1644- continue
1643+ noAvailableStrMap [nodeName ] = noAvailableStr
1644+ logs .GetLogger ().Warnf ("the job_uuid: %s is not available for this node=%s resource. Reason: %s" ,
1645+ jobUuid , node .Name , strings .Join (noAvailableStr , ";" ))
16451646 }
16461647 }
16471648
@@ -1656,7 +1657,8 @@ func checkResourceAvailableForSpace(jobUuid string, jobType int, resourceConfig
16561657 noAvailableSummary = append (noAvailableSummary , "not found available node" )
16571658 return false , "" , nil , 0 , noAvailableSummary , nil
16581659 } else {
1659- return false , "" , nil , 0 , noAvailableStr , nil
1660+ nodeName := nodes .Items [0 ].Name
1661+ return false , "" , nil , 0 , noAvailableStrMap [nodeName ], nil
16601662 }
16611663}
16621664
@@ -1696,8 +1698,9 @@ func checkResourceAvailableForImage(jobUuid string, hardwareType string, resourc
16961698 FreeIndex []string
16971699 }
16981700
1699- var noAvailableStr [] string
1701+ var noAvailableStrMap = make ( map [ string ][] string )
17001702 for _ , node := range nodes .Items {
1703+ var noAvailableStr []string
17011704 var nodeName = node .Name
17021705 var nodeGpuInfo = nodeGpuSummary [nodeName ]
17031706 nodeGpu , remainderResource , _ := GetNodeResource (activePods , & node )
@@ -1730,6 +1733,7 @@ func checkResourceAvailableForImage(jobUuid string, hardwareType string, resourc
17301733 if len (noAvailableStr ) == 0 {
17311734 return true , nodeName , nil , nil , nil , nil
17321735 } else {
1736+ noAvailableStrMap [nodeName ] = noAvailableStr
17331737 logs .GetLogger ().Warnf ("the job_uuid: %s is not available for this node=%s resource. Reason: %s" ,
17341738 jobUuid , node .Name , strings .Join (noAvailableStr , ";" ))
17351739 }
@@ -1778,6 +1782,7 @@ func checkResourceAvailableForImage(jobUuid string, hardwareType string, resourc
17781782 } else {
17791783 if gpuNoAvailableStr != nil {
17801784 noAvailableStr = append (gpuNoAvailableStr , gpuNoAvailableStr ... )
1785+ noAvailableStrMap [node .Name ] = noAvailableStr
17811786 }
17821787 }
17831788 }
@@ -1794,7 +1799,8 @@ func checkResourceAvailableForImage(jobUuid string, hardwareType string, resourc
17941799 noAvailableSummary = append (noAvailableSummary , "not found available node" )
17951800 return false , "" , nil , nil , noAvailableSummary , nil
17961801 } else {
1797- return false , "" , nil , nil , noAvailableStr , nil
1802+ nodeName := nodes .Items [0 ].Name
1803+ return false , "" , nil , nil , noAvailableStrMap [nodeName ], nil
17981804 }
17991805}
18001806
0 commit comments