Skip to content

Commit

Permalink
Merge pull request #651 from sivanzcw/develop
Browse files Browse the repository at this point in the history
Reclaim Enhancement: Add Reclaimable parameter for queue
  • Loading branch information
volcano-sh-bot committed Jan 2, 2020
2 parents aab4757 + 4208c42 commit 082af9d
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/apis/scheduling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ type QueueSpec struct {
Capability v1.ResourceList
// State controller the status of queue
State QueueState
// Reclaimable indicate whether the queue can be reclaimed by other queue
Reclaimable *bool
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/scheduling/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/apis/scheduling/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ type QueueSpec struct {
Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"`
// State controller the status of queue
State QueueState `json:"state,omitempty" protobuf:"bytes,3,opt,name=state"`
// Reclaimable indicate whether the queue can be reclaimed by other queue
Reclaimable *bool `json:"reclaimable,omitempty" protobuf:"bytes,4,opt,name=reclaimable"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/scheduling/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/scheduling/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/scheduling/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/scheduler/actions/reclaim/reclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func (alloc *reclaimAction) Execute(ssn *framework.Session) {
if j, found := ssn.Jobs[task.Job]; !found {
continue
} else if j.Queue != job.Queue {
q := ssn.Queues[j.Queue]
if !q.Reclaimable() {
continue
}
// Clone task to avoid modify Task's status on node.
reclaimees = append(reclaimees, task.Clone())
}
Expand Down
17 changes: 17 additions & 0 deletions pkg/scheduler/api/queue_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,20 @@ func (q *QueueInfo) Clone() *QueueInfo {
Queue: q.Queue,
}
}

// Reclaimable return whether queue is reclaimable
func (q *QueueInfo) Reclaimable() bool {
if q == nil {
return false
}

if q.Queue == nil {
return false
}

if q.Queue.Spec.Reclaimable == nil {
return true
}

return *q.Queue.Spec.Reclaimable
}

0 comments on commit 082af9d

Please sign in to comment.