yangwwei commented on a change in pull request #192:
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/192#discussion_r493880656
##########
File path: pkg/apis/yunikorn.apache.org/v1alpha1/type.go
##########
@@ -33,15 +34,42 @@ type Application struct {
Status ApplicationStatus `json:"status"`
}
-//Spec part
+// Spec part
type ApplicationSpec struct {
- MinMember int32 `json:"minMember"`
- Queue string `json:"queue"`
- MaxPendingSeconds int32 `json:"maxPendingSeconds,omitempty"`
+ Policy SchedulePolicy `json:"schedulingPolicy"`
+ Queue string `json:"queue"`
+ TaskGroup []Task `json:"taskGroups"`
}
-//Status part
+type SchedulePolicy struct {
+ Policy SchedulingPolicy `json:"name"`
+ Parameter map[PolicyParam]int32 `json:"parameter,omitempty"`
+}
+
+type SchedulingPolicy string
+
+const (
+ TryOnce SchedulingPolicy = "TryOnce"
+ MaxRetry SchedulingPolicy = "MaxRetry"
+ TryReserve SchedulingPolicy = "TryReserve"
+ TryPreempt SchedulingPolicy = "TryPreempt"
+)
+
+type PolicyParam string
+
+const (
+ Timeout PolicyParam = "Timeout"
+ RetrySecond PolicyParam = "RetrySecond"
+)
+
+type Task struct {
+ Name string `json:"taskName"`
Review comment:
this should be `groupName`
as we are declaring multiple gang groups here
##########
File path: pkg/apis/yunikorn.apache.org/v1alpha1/type.go
##########
@@ -33,15 +34,42 @@ type Application struct {
Status ApplicationStatus `json:"status"`
}
-//Spec part
+// Spec part
type ApplicationSpec struct {
- MinMember int32 `json:"minMember"`
- Queue string `json:"queue"`
- MaxPendingSeconds int32 `json:"maxPendingSeconds,omitempty"`
+ Policy SchedulePolicy `json:"schedulingPolicy"`
+ Queue string `json:"queue"`
+ TaskGroup []Task `json:"taskGroups"`
}
-//Status part
+type SchedulePolicy struct {
+ Policy SchedulingPolicy `json:"name"`
+ Parameter map[PolicyParam]int32 `json:"parameter,omitempty"`
Review comment:
2 comments for this:
- this should be `Parameters`, as we allow to set multiple options
- I prefer to define the value as `string` type, use int will not give us
enough flexibility
##########
File path: pkg/apis/yunikorn.apache.org/v1alpha1/type.go
##########
@@ -33,15 +34,42 @@ type Application struct {
Status ApplicationStatus `json:"status"`
}
-//Spec part
+// Spec part
type ApplicationSpec struct {
- MinMember int32 `json:"minMember"`
- Queue string `json:"queue"`
- MaxPendingSeconds int32 `json:"maxPendingSeconds,omitempty"`
+ Policy SchedulePolicy `json:"schedulingPolicy"`
+ Queue string `json:"queue"`
+ TaskGroup []Task `json:"taskGroups"`
}
-//Status part
+type SchedulePolicy struct {
+ Policy SchedulingPolicy `json:"name"`
+ Parameter map[PolicyParam]int32 `json:"parameter,omitempty"`
+}
+
+type SchedulingPolicy string
+
+const (
+ TryOnce SchedulingPolicy = "TryOnce"
+ MaxRetry SchedulingPolicy = "MaxRetry"
+ TryReserve SchedulingPolicy = "TryReserve"
+ TryPreempt SchedulingPolicy = "TryPreempt"
+)
+
+type PolicyParam string
+
+const (
+ Timeout PolicyParam = "Timeout"
+ RetrySecond PolicyParam = "RetrySecond"
+)
Review comment:
Every policy will have different parameters. We do not need to
pre-define them here.
It can be just a map of strings.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]