Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Inqueue status #399

Merged
merged 2 commits into from
Jul 31, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update Inqueue status
  • Loading branch information
hzxuzhonghu committed Jul 31, 2019
commit 970fe7d82e478270556a9ab0ba8fabc3b64f212f
8 changes: 6 additions & 2 deletions pkg/controllers/queue/queue_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (c *Controller) processNextWorkItem() bool {
func (c *Controller) syncQueue(key string) error {
glog.V(4).Infof("Begin sync queue %s", key)

var pending, running, unknown int32
var pending, running, unknown, inqueue int32
c.pgMutex.RLock()
if c.podGroups[key] == nil {
c.pgMutex.RUnlock()
Expand Down Expand Up @@ -169,6 +169,8 @@ func (c *Controller) syncQueue(key string) error {
running++
case schedulingv1alpha2.PodGroupUnknown:
unknown++
case schedulingv1alpha2.PodGroupInqueue:
inqueue++
}
}

Expand All @@ -183,14 +185,16 @@ func (c *Controller) syncQueue(key string) error {

glog.V(4).Infof("queue %s jobs pending %d, running %d, unknown %d", key, pending, running, unknown)
// ignore update when status doesnot change
if pending == queue.Status.Pending && running == queue.Status.Running && unknown == queue.Status.Unknown {
if pending == queue.Status.Pending && running == queue.Status.Running &&
unknown == queue.Status.Unknown && inqueue == queue.Status.Inqueue {
return nil
}

newQueue := queue.DeepCopy()
newQueue.Status.Pending = pending
newQueue.Status.Running = running
newQueue.Status.Unknown = unknown
newQueue.Status.Inqueue = inqueue

if _, err := c.kbClient.SchedulingV1alpha2().Queues().UpdateStatus(newQueue); err != nil {
glog.Errorf("Failed to update status of Queue %s: %v", newQueue.Name, err)
Expand Down