-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(suggestion): Use interface (#502)
* refactor(suggestion): Use interface Signed-off-by: Ce Gao <gaoce@caicloud.io> * feat(cmd): Add flags to control the fake logic Signed-off-by: Ce Gao <gaoce@caicloud.io> * gopkg: Update Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Revert package names Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Use string Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Address comments Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Address comment Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix bug Signed-off-by: Ce Gao <gaoce@caicloud.io>
- Loading branch information
1 parent
b5d3cc1
commit 5478db4
Showing
8 changed files
with
212 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package consts | ||
|
||
const ( | ||
ConfigExperimentSuggestionName string = "experiment-suggestion-name" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
pkg/controller/v1alpha2/experiment/suggestion/fake/fake.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package fake | ||
|
||
import ( | ||
experimentsv1alpha2 "github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2" | ||
api_pb "github.com/kubeflow/katib/pkg/api/v1alpha2" | ||
"github.com/kubeflow/katib/pkg/controller/v1alpha2/experiment/suggestion" | ||
) | ||
|
||
type Fake struct { | ||
} | ||
|
||
func New() suggestion.Suggestion { | ||
return &Fake{} | ||
} | ||
|
||
func (k *Fake) GetSuggestions(instance *experimentsv1alpha2.Experiment, addCount int) ([]*api_pb.Trial, error) { | ||
return nil, nil | ||
} |
23 changes: 23 additions & 0 deletions
23
pkg/controller/v1alpha2/experiment/suggestion/suggestion.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package suggestion | ||
|
||
import ( | ||
"fmt" | ||
|
||
experimentsv1alpha2 "github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2" | ||
api_pb "github.com/kubeflow/katib/pkg/api/v1alpha2" | ||
) | ||
|
||
type Suggestion interface { | ||
GetSuggestions(instance *experimentsv1alpha2.Experiment, addCount int) ([]*api_pb.Trial, error) | ||
} | ||
|
||
type General struct { | ||
} | ||
|
||
func New() Suggestion { | ||
return &General{} | ||
} | ||
|
||
func (g *General) GetSuggestions(instance *experimentsv1alpha2.Experiment, addCount int) ([]*api_pb.Trial, error) { | ||
return nil, fmt.Errorf("Not implemented") | ||
} |
Oops, something went wrong.