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

refactor(suggestion): Use interface #502

Merged
merged 8 commits into from
May 14, 2019
Merged

Conversation

gaocegege
Copy link
Member

@gaocegege gaocegege commented May 13, 2019

There are some benefits to define an interface instead of using util.GetSuggestions function:

  • Easy to test and maintain. We can write unit test cases for the interface.
  • Easy to integrate. We can mock the suggestion when testing the experiment controller, or use a fake controller to run the experiment without affecting the real logic.

This PR:

  • added a CLI argument to control if we use fake implementation in the controller. If not, now we will always return an error becuase we do not implement suggestion logic now.
  -fake-experiment-suggestion
    	Use the fake suggestion in experiment controller
  • added a interface about suggestion.

Signed-off-by: Ce Gao gaoce@caicloud.io


This change is Reviewable

@gaocegege
Copy link
Member Author

/cc @johnugeorge @richardsliu @YujiOshima

PTAL

@johnugeorge
Copy link
Member

/lgtm

Copy link
Member Author

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot k8s-ci-robot removed the lgtm label May 13, 2019
@gaocegege
Copy link
Member Author

@hougangliu PTAL

cmd/katib-controller/v1alpha2/main.go Outdated Show resolved Hide resolved
pkg/controller/v1alpha2/consts/const.go Outdated Show resolved Hide resolved
@hougangliu
Copy link
Member

hougangliu commented May 13, 2019

@hougangliu PTAL

@gaocegege Thanks. some mini comment

@gaocegege
Copy link
Member Author

@hougangliu PTAL
@gaocegege Thanks. some mini comment

Addressed, Thanks for your review. PTAL

@hougangliu
Copy link
Member

/lgtm
thanks

@k8s-ci-robot k8s-ci-robot removed the lgtm label May 13, 2019
@hougangliu
Copy link
Member

/lgtm

@YujiOshima
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gaocegege, YujiOshima

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [YujiOshima,gaocegege]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot removed the lgtm label May 13, 2019
@gaocegege
Copy link
Member Author

@hougangliu PTAL again, fixed a bug.

@gaocegege
Copy link
Member Author

/retest

2 similar comments
@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/retest

Client: mgr.GetClient(),
scheme: mgr.GetScheme(),
}
imp := viper.GetString(consts.ConfigExperimentSuggestionName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check: Is there a better way to pass flags to the manager than using viper?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea. Kubebuilder does not support a built-in way, thus I use viper here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work for you?

@gaocegege
Copy link
Member Author

/retest

2 similar comments
@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/retest

Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
Signed-off-by: Ce Gao <gaoce@caicloud.io>
@gaocegege
Copy link
Member Author

/retest

4 similar comments
@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/retest

@johnugeorge
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot merged commit 5478db4 into kubeflow:master May 14, 2019
@gaocegege gaocegege deleted the re branch May 15, 2019 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants