Skip to content

Commit

Permalink
[YUNIKORN-421] Define app gang scheduling info in API package.
Browse files Browse the repository at this point in the history
  • Loading branch information
yangwwei committed Oct 22, 2020
1 parent aba697c commit db6a4a0
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 27 deletions.
37 changes: 22 additions & 15 deletions pkg/apis/yunikorn.apache.org/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package v1alpha1

import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -37,29 +38,35 @@ type Application struct {
// Spec part

type ApplicationSpec struct {
Policy SchedulePolicy `json:"schedulingPolicy"`
Queue string `json:"queue"`
TaskGroup []Task `json:"taskGroups"`
Queue string `json:"queue"`
TaskGroups []TaskGroup `json:"taskGroups"`
}

type SchedulePolicy struct {
Policy SchedulingPolicy `json:"name"`
Parameters map[string]string `json:"parameters,omitempty"`
type SchedulingPolicy struct {
Type SchedulingPolicyType `json:"type"`
Parameters map[string]string `json:"parameters,omitempty"`
}

type SchedulingPolicy string
type SchedulingPolicyType string

const (
TryOnce SchedulingPolicy = "TryOnce"
MaxRetry SchedulingPolicy = "MaxRetry"
TryReserve SchedulingPolicy = "TryReserve"
TryPreempt SchedulingPolicy = "TryPreempt"
TryOnce SchedulingPolicyType = "TryOnce"
MaxRetry SchedulingPolicyType = "MaxRetry"
TryReserve SchedulingPolicyType = "TryReserve"
TryPreempt SchedulingPolicyType = "TryPreempt"
)

type Task struct {
GroupName string `json:"groupName"`
MinMember int32 `json:"minMember"`
MinResource map[string]resource.Quantity `json:"minResource"`
type TaskGroups struct {
SchedulingPolicy SchedulingPolicy `json:"schedulingPolicy"`
TaskGroups []TaskGroup `json:"taskGroups"`
}

type TaskGroup struct {
Name string `json:"name"`
MinMember int32 `json:"minMember"`
MinResource map[string]resource.Quantity `json:"minResource"`
NodeSelector metav1.LabelSelector `json:"nodeSelector,omitempty"`
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
}

// Status part
Expand Down
56 changes: 44 additions & 12 deletions pkg/apis/yunikorn.apache.org/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit db6a4a0

Please sign in to comment.