-
Notifications
You must be signed in to change notification settings - Fork 4
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
v1alpha3: Add suggestion CRD #1
Changes from all commits
5a7a144
728b37b
bc57a6d
6213e63
1c3994c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
Copyright 2018 The Kubeflow Authors | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
/* | ||
Katib-controller is a controller (operator) for Experiments and Trials | ||
*/ | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/kubeflow/katib/pkg/api/operators/apis" | ||
controller "github.com/kubeflow/katib/pkg/controller/v1alpha3" | ||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" | ||
"sigs.k8s.io/controller-runtime/pkg/client/config" | ||
"sigs.k8s.io/controller-runtime/pkg/manager" | ||
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" | ||
"sigs.k8s.io/controller-runtime/pkg/runtime/signals" | ||
) | ||
|
||
func main() { | ||
logf.SetLogger(logf.ZapLogger(false)) | ||
// Get a config to talk to the apiserver | ||
cfg, err := config.GetConfig() | ||
if err != nil { | ||
log.Printf("config.GetConfig()") | ||
log.Fatal(err) | ||
} | ||
|
||
// Create a new katib controller to provide shared dependencies and start components | ||
mgr, err := manager.New(cfg, manager.Options{}) | ||
if err != nil { | ||
log.Printf("manager.New") | ||
log.Fatal(err) | ||
} | ||
|
||
log.Printf("Registering Components.") | ||
|
||
// Setup Scheme for all resources | ||
if err := apis.AddToScheme(mgr.GetScheme()); err != nil { | ||
log.Printf("apis.AddToScheme") | ||
log.Fatal(err) | ||
} | ||
|
||
// Setup katib controller | ||
if err := controller.AddToManager(mgr); err != nil { | ||
log.Printf("controller.AddToManager(mgr)") | ||
log.Fatal(err) | ||
} | ||
|
||
log.Printf("Starting the Cmd.") | ||
|
||
// Starting the katib controller | ||
log.Fatal(mgr.Start(signals.SetupSignalHandler())) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package apis | ||
|
||
import ( | ||
"github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package apis | ||
|
||
import ( | ||
experiments "github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2" | ||
trials "github.com/kubeflow/katib/pkg/api/operators/apis/trial/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, experiments.SchemeBuilder.AddToScheme, trials.SchemeBuilder.AddToScheme) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package apis | ||
|
||
import ( | ||
"github.com/kubeflow/katib/pkg/api/operators/apis/suggestion/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package apis | ||
|
||
import ( | ||
"github.com/kubeflow/katib/pkg/api/operators/apis/trial/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package v1alpha2 | ||
|
||
const ( | ||
// Default value of Spec.ParallelTrialCount | ||
DefaultTrialParallelCount = 3 | ||
|
||
// Default value of Spec.ConfigMapName | ||
DefaultTrialConfigMapName = "trial-template" | ||
|
||
// Default env name of katib namespace | ||
DefaultKatibNamespaceEnvName = "KATIB_CORE_NAMESPACE" | ||
|
||
// Default value of Spec.TemplatePath | ||
DefaultTrialTemplatePath = "defaultTrialTemplate.yaml" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,10 +35,14 @@ type ExperimentSpec struct { | |
TrialTemplate *TrialTemplate `json:"trialTemplate,omitempty"` | ||
|
||
// How many trials can be processed in parallel. | ||
ParallelTrialCount int `json:"parallelTrialCount,omitempty"` | ||
// Defaults to 3 | ||
ParallelTrialCount *int `json:"parallelTrialCount,omitempty"` | ||
|
||
// Total number of trials to run. | ||
MaxTrialCount int `json:"maxTrialCount,omitempty"` | ||
// Max completed trials to mark experiment as succeeded | ||
MaxTrialCount *int `json:"maxTrialCount,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name as MinTrialCount? Minimum trail count for success.. |
||
|
||
// Max failed trials to mark experiment as failed. | ||
MaxFailedTrialCount *int `json:"maxFailedTrialCount,omitempty"` | ||
|
||
// Whether to retain historical data in DB after deletion. | ||
RetainHistoricalData bool `json:"retainHistoricalData,omitempty"` | ||
|
@@ -75,8 +79,8 @@ type ExperimentStatus struct { | |
// Current optimal trial parameters and observations. | ||
CurrentOptimalTrial OptimalTrial `json:"currentOptimalTrial,omitempty"` | ||
|
||
// How many trials have successfully completed. | ||
TrialsCompleted int `json:"trialsCompleted,omitempty"` | ||
// How many trials have succeeded. | ||
TrialsSucceeded int `json:"trialsSucceeded,omitempty"` | ||
|
||
// How many trials have failed. | ||
TrialsFailed int `json:"trialsFailed,omitempty"` | ||
|
@@ -86,6 +90,9 @@ type ExperimentStatus struct { | |
|
||
// How many trials are currently pending. | ||
TrialsPending int `json:"trialsPending,omitempty"` | ||
|
||
// How many trials are currently running. | ||
TrialsRunning int `json:"trialsRunning,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And where do we record periodical metric? |
||
} | ||
|
||
type OptimalTrial struct { | ||
|
@@ -154,7 +161,7 @@ type FeasibleSpace struct { | |
|
||
type ObjectiveSpec struct { | ||
Type ObjectiveType `json:"type,omitempty"` | ||
Goal float64 `json:"goal,omitempty"` | ||
Goal *float64 `json:"goal,omitempty"` | ||
ObjectiveMetricName string `json:"objectiveMetricName,omitempty"` | ||
// This can be empty if we only care about the objective metric. | ||
// Note: If we adopt a push instead of pull mechanism, this can be omitted completely. | ||
|
@@ -206,6 +213,7 @@ type GoTemplate struct { | |
|
||
// Structure of the Experiment custom resource. | ||
// +k8s:openapi-gen=true | ||
// +kubebuilder:subresource:status | ||
type Experiment struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
@@ -231,7 +239,7 @@ type NasConfig struct { | |
|
||
// GraphConfig contains a config of DAG | ||
type GraphConfig struct { | ||
NumLayers int32 `json:"numLayers,omitempty"` | ||
NumLayers *int32 `json:"numLayers,omitempty"` | ||
InputSizes []int32 `json:"inputSizes,omitempty"` | ||
OutputSizes []int32 `json:"outputSizes,omitempty"` | ||
} | ||
|
@@ -242,7 +250,6 @@ type Operation struct { | |
Parameters []ParameterSpec `json:"parameterconfigs,omitempty"` | ||
} | ||
|
||
// TODO - enable this during API implementation. | ||
//func init() { | ||
// SchemeBuilder.Register(&Experiment{}, &ExperimentList{}) | ||
//} | ||
func init() { | ||
SchemeBuilder.Register(&Experiment{}, &ExperimentList{}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
experiment: v1alpha3
trial: v1alpha2 (?)
suggestion: v1alpha2 (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API
GRPC API
controller