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

rem stale code #506

Merged
merged 5 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
5 changes: 0 additions & 5 deletions pkg/client/informers/controller-externalversion/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
resource: resource.GroupResource(),
informer: f.SchedulingSpec().SchedulingSpecs().Informer(),
}, nil
case arbv1.SchemeGroupVersion.WithResource("queuejobs"):
return &genericInformer{
resource: resource.GroupResource(),
informer: f.QueueJob().QueueJobs().Informer(),
}, nil
case arbv1.SchemeGroupVersion.WithResource("appwrappers"):
return &genericInformer{
resource: resource.GroupResource(),
Expand Down
14 changes: 3 additions & 11 deletions pkg/client/informers/controller-externalversion/v1/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,13 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// SchedulingSpecs returns a SchedulingSpecInformer.
SchedulingSpecs() SchedulingSpecInformer
// QueueJobs returns a QueueJobInformer.
QueueJobs() QueueJobInformer
SchedulingSpecs() SchedulingSpecInformer
// AppWrappers returns a QueueJobInformer.
AppWrappers() AppWrapperInformer
AppWrappers() AppWrapperInformer
asm582 marked this conversation as resolved.
Show resolved Hide resolved
}


type version struct {
factory internalinterfaces.SharedInformerFactory
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}

Expand All @@ -60,11 +57,6 @@ func (v *version) SchedulingSpecs() SchedulingSpecInformer {
return &schedulingSpecInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

// QueueJobs returns a QueueJobInformer.
func (v *version) QueueJobs() QueueJobInformer {
return &queueJobInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

func (v *version) AppWrappers() AppWrapperInformer {
return &appWrapperInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
86 changes: 0 additions & 86 deletions pkg/client/informers/controller-externalversion/v1/queuejob.go

This file was deleted.

105 changes: 0 additions & 105 deletions pkg/client/listers/controller/v1/queuejob.go

This file was deleted.

39 changes: 0 additions & 39 deletions pkg/controller/clusterstate/api/cluster_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,7 @@ limitations under the License.
*/
package api

import "fmt"

// ClusterInfo is a snapshot of cluster by cache.
type ClusterInfo struct {
Jobs []*JobInfo

Nodes []*NodeInfo
}

func (ci ClusterInfo) String() string {

str := "Cache:\n"

if len(ci.Nodes) != 0 {
str = str + "Nodes:\n"
for _, n := range ci.Nodes {
str = str + fmt.Sprintf("\t %s: idle(%v) used(%v) allocatable(%v) pods(%d)\n",
n.Name, n.Idle, n.Used, n.Allocatable, len(n.Tasks))

i := 0
for _, p := range n.Tasks {
str = str + fmt.Sprintf("\t\t %d: %v\n", i, p)
i++
}
}
}

if len(ci.Jobs) != 0 {
str = str + "Jobs:\n"
for _, job := range ci.Jobs {
str = str + fmt.Sprintf("\t Job(%s) name(%s) minAvailable(%v)\n",
job.UID, job.Name, job.MinAvailable)

i := 0
for _, task := range job.Tasks {
str = str + fmt.Sprintf("\t\t %d: %v\n", i, task)
i++
}
}
}

return str
}
24 changes: 0 additions & 24 deletions pkg/controller/clusterstate/api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,8 @@ import (
"fmt"

v1 "k8s.io/api/core/v1"
clientcache "k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
)

// PodKey returns the string key of a pod.
func PodKey(pod *v1.Pod) TaskID {
if key, err := clientcache.MetaNamespaceKeyFunc(pod); err != nil {
return TaskID(fmt.Sprintf("%v/%v", pod.Namespace, pod.Name))
} else {
return TaskID(key)
}
}

func getTaskStatus(pod *v1.Pod) TaskStatus {
switch pod.Status.Phase {
case v1.PodRunning:
Expand Down Expand Up @@ -111,19 +100,6 @@ func MergeErrors(errs ...error) error {
return nil
}

// JobTerminated checkes whether job was terminated.
func JobTerminated(job *JobInfo) bool {
if job.SchedSpec == nil && len(job.Tasks) == 0 {
klog.V(9).Infof("Job: %v is terminated.", job.UID)
return true
} else {
klog.V(10).Infof("Job: %v not terminated, scheduleSpec: %v, tasks: %v.",
job.UID, job.SchedSpec, job.Tasks)
return false
}

}

func NewStringsMap(source map[string]string) map[string]string {
target := make(map[string]string)

Expand Down
Loading