Ensure handling for specialization failure in pool manager (#2788)
* Add fixes for failure in specialization * reduce specialization in progress and remove expired requests from queue when specialization is timed out * rename markSpecializationFailure and remove logger from the queue * refactor clean up code in api.go and add test case for queue Details: - Cleanup svc waiting for the counter in the pool manager if specialization fails - Cleanup active requests counter in pool manager if client exists the demand for function service while we have allocated function service - Consider specialization timeout if pod ready timeout > specialization timeout in waiting for ready pod. We also consider if the request to choosePod is cancelled. - We ensure if we have requests waiting for service requests but if there is no pod in the specialization we clean up those. --------- Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> Co-authored-by: Pranoy Kundu <pranoy1998k@gmail.com>
This commit is contained in:
co-authored by
Pranoy Kundu
parent
31c81e132e
commit
6c431e4d9b
@@ -36,6 +36,7 @@ const (
|
||||
markAvailable
|
||||
deleteValue
|
||||
setCPUUtilization
|
||||
markSpecializationFailure
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -232,6 +233,14 @@ func (c *PoolCache) service() {
|
||||
}
|
||||
}
|
||||
}
|
||||
case markSpecializationFailure:
|
||||
if c.cache[req.function].svcWaiting > c.cache[req.function].queue.Len() {
|
||||
c.cache[req.function].svcWaiting--
|
||||
if c.cache[req.function].svcWaiting == c.cache[req.function].queue.Len() {
|
||||
expiredRequests := c.cache[req.function].queue.Expired()
|
||||
c.cache[req.function].svcWaiting = c.cache[req.function].svcWaiting - expiredRequests
|
||||
}
|
||||
}
|
||||
case deleteValue:
|
||||
delete(c.cache[req.function].svcs, req.address)
|
||||
req.responseChannel <- resp
|
||||
@@ -328,3 +337,12 @@ func (c *PoolCache) DeleteValue(ctx context.Context, function, address string) e
|
||||
resp := <-respChannel
|
||||
return resp.error
|
||||
}
|
||||
|
||||
// ReduceSpecializationInProgress reduces the svcWaiting count
|
||||
func (c *PoolCache) MarkSpecializationFailure(function string) {
|
||||
c.requestChannel <- &request{
|
||||
requestType: markSpecializationFailure,
|
||||
function: function,
|
||||
responseChannel: make(chan *response),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user