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

Suggestion volume resumePolicy override #1992

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion examples/v1beta1/hp-tuning/simple-pbt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ spec:
maxTrialCount: 2
parallelTrialCount: 2
maxFailedTrialCount: 3
resumePolicy: FromVolume
objective:
type: maximize
goal: 0.99
Expand Down
4 changes: 4 additions & 0 deletions hack/gen-python-sdk/post_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def update_python_sdk(src, dest, versions=('v1beta1')):
'[**V1Container**](https://github.com/kubernetes-client/'
'python/blob/master/kubernetes/docs/V1Container.md)'),

lambda l: l.replace('[**V1DeploymentSpec**](V1DeploymentSpec.md)',
'[**V1DeploymentSpec**](https://github.com/kubernetes-client/'
'python/blob/master/kubernetes/docs/V1DeploymentSpec.md)'),

lambda l: l.replace('[**V1ObjectMeta**](V1ObjectMeta.md)',
'[**V1ObjectMeta**](https://github.com/kubernetes-client/'
'python/blob/master/kubernetes/docs/V1ObjectMeta.md)'),
Expand Down
1 change: 1 addition & 0 deletions hack/gen-python-sdk/swagger_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"packageVersion": "0.1",
"importMappings": {
"V1Container": "from kubernetes.client import V1Container",
"V1DeploymentSpec": "from kubernetes.client import V1DeploymentSpec",
"V1ListMeta": "from kubernetes.client import V1ListMeta",
"V1ObjectMeta": "from kubernetes.client import V1ObjectMeta",
"V1HTTPGetAction": "from kubernetes.client import V1HTTPGetAction",
Expand Down
1 change: 1 addition & 0 deletions hack/swagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func swaggify(name string) string {
name = strings.Replace(name, "github.com/kubeflow/katib/pkg/apis/controller/suggestions", "", -1)
name = strings.Replace(name, "github.com/kubeflow/katib/pkg/apis/controller/trials", "", -1)
name = strings.Replace(name, "k8s.io/api/core/", "", -1)
name = strings.Replace(name, "k8s.io/api/apps/", "", -1)
name = strings.Replace(name, "k8s.io/apimachinery/pkg/apis/meta/", "", -1)
name = strings.Replace(name, "/", ".", -1)
return name
Expand Down
10 changes: 7 additions & 3 deletions pkg/apis/controller/common/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ limitations under the License.
package v1beta1

import (
v1 "k8s.io/api/core/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
)

// AlgorithmSpec is the specification for a HP or NAS algorithm.
Expand All @@ -28,6 +29,9 @@ type AlgorithmSpec struct {

// Key-value pairs representing settings for suggestion algorithms.
AlgorithmSettings []AlgorithmSetting `json:"algorithmSettings,omitempty"`

// Suggestion service Deployment spec
SuggestionSpec appsv1.DeploymentSpec `json:"suggestionSpec,omitempty"`
}

// AlgorithmSetting represents key-value pair for HP or NAS algorithm settings.
Expand Down Expand Up @@ -163,7 +167,7 @@ type MetricsCollectorSpec struct {
type SourceSpec struct {
// Model-train source code can expose metrics by http, such as HTTP endpoint in
// prometheus metric format
HttpGet *v1.HTTPGetAction `json:"httpGet,omitempty"`
HttpGet *corev1.HTTPGetAction `json:"httpGet,omitempty"`
// During training model, metrics may be persisted into local file in source
// code, such as tfEvent use case
FileSystemPath *FileSystemPath `json:"fileSystemPath,omitempty"`
Expand Down Expand Up @@ -230,5 +234,5 @@ const (
type CollectorSpec struct {
Kind CollectorKind `json:"kind,omitempty"`
// When kind is "customCollector", this field will be used
CustomCollector *v1.Container `json:"customCollector,omitempty"`
CustomCollector *corev1.Container `json:"customCollector,omitempty"`
}

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

262 changes: 137 additions & 125 deletions pkg/apis/manager/v1beta1/api.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/apis/manager/v1beta1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ syntax = "proto3";

package api.v1.beta1;

import "k8s.io/api/apps/v1/generated.proto";

/**
* DBManager service defines APIs to manage Katib database.
*/
Expand Down Expand Up @@ -134,6 +136,7 @@ enum ObjectiveType {
message AlgorithmSpec {
string algorithm_name = 1;
repeated AlgorithmSetting algorithm_settings = 2;
k8s.io.api.apps.v1.DeploymentSpec suggestion_spec = 3;
}

/**
Expand Down
49 changes: 45 additions & 4 deletions pkg/apis/manager/v1beta1/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,50 @@ cd "$(dirname "$0")"

proto="api.proto"

docker run -i --rm -v "$PWD:$PWD" -w "$PWD" znly/protoc --python_out=plugins=grpc:./python --go_out=plugins=grpc:. -I. $proto
docker run -i --rm -v "$PWD:$PWD" -w "$PWD" znly/protoc --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin --python_out=./python --grpc_out=./python -I. $proto
# Get host paths for kubernetes api modules
GO_MOD_K8S_API=$(go list -m -f '{{.Dir}}' k8s.io/api)
GO_MOD_K8S_APIMACHINERY=$(go list -m -f '{{.Dir}}' k8s.io/apimachinery)

# Generate python k8s api files
docker run -i --rm \
-v "$PWD:$PWD" \
-v "$GO_MOD_K8S_APIMACHINERY:$GOPATH/pkg/mod/k8s.io/apimachinery" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
-w "$PWD" \
znly/protoc \
-I "${GOPATH}/pkg/mod" --python_out=python \
"${GOPATH}/pkg/mod/k8s.io/api/apps/v1/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/api/core/v1/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/runtime/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/api/resource/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/runtime/schema/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/util/intstr/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"

# Generate $proto files
docker run -i --rm \
-v "$PWD:$PWD" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
-v "$GO_MOD_K8S_APIMACHINERY:$GOPATH/pkg/mod/k8s.io/apimachinery" \
-w "$PWD" \
znly/protoc --python_out=plugins=grpc:./python --go_out=plugins=grpc:. -I="$GOPATH/pkg/mod/" -I. $proto
docker run -i --rm \
-v "$PWD:$PWD" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
-v "$GO_MOD_K8S_APIMACHINERY:$GOPATH/pkg/mod/k8s.io/apimachinery" \
-w "$PWD" \
znly/protoc --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin --python_out=./python --grpc_out=./python -I "$GOPATH/pkg/mod/" -I. $proto

docker build -t protoc-gen-doc gen-doc/
docker run --rm -v "$PWD/gen-doc:/out" -v "$PWD:/apiprotos" protoc-gen-doc --doc_opt=markdown,api.md -I /protobuf -I /apiprotos $proto
docker run --rm -v "$PWD/gen-doc:/out" -v "$PWD:/apiprotos" protoc-gen-doc --doc_opt=html,index.html -I /protobuf -I /apiprotos $proto
docker run --rm \
-v "$PWD/gen-doc:/out" \
-v "$PWD:/apiprotos" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
-v "$GO_MOD_K8S_APIMACHINERY:$GOPATH/pkg/mod/k8s.io/apimachinery" \
protoc-gen-doc --doc_opt=markdown,api.md -I "$GOPATH/pkg/mod/" -I /protobuf -I /apiprotos $proto
docker run --rm \
-v "$PWD/gen-doc:/out" \
-v "$PWD:/apiprotos" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
-v "$GO_MOD_K8S_APIMACHINERY:$GOPATH/pkg/mod/k8s.io/apimachinery" \
protoc-gen-doc --doc_opt=html,index.html -I "$GOPATH/pkg/mod/" -I /protobuf -I /apiprotos $proto
1 change: 1 addition & 0 deletions pkg/apis/manager/v1beta1/gen-doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ HP or NAS algorithm specification.
| ----- | ---- | ----- | ----------- |
| algorithm_name | [string](#string) | | |
| algorithm_settings | [AlgorithmSetting](#api-v1-beta1-AlgorithmSetting) | repeated | |
| suggestion_spec | [k8s.io.api.apps.v1.DeploymentSpec](#k8s-io-api-apps-v1-DeploymentSpec) | | |



Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/manager/v1beta1/gen-doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,13 @@ <h3 id="api.v1.beta1.AlgorithmSpec">AlgorithmSpec</h3>
<td><p> </p></td>
</tr>

<tr>
<td>suggestion_spec</td>
<td><a href="#k8s.io.api.apps.v1.DeploymentSpec">k8s.io.api.apps.v1.DeploymentSpec</a></td>
<td></td>
<td><p> </p></td>
</tr>

</tbody>
</table>

Expand Down
218 changes: 114 additions & 104 deletions pkg/apis/manager/v1beta1/python/api_pb2.py

Large diffs are not rendered by default.

Loading
Loading