-
Notifications
You must be signed in to change notification settings - Fork 448
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
New Trial Template API controller implementation #1202
New Trial Template API controller implementation #1202
Conversation
@andreyvelich: GitHub didn't allow me to request PR reviews from the following users: nielsmeima, czheng94, terrykong. Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
TrialSpec *unstructured.Unstructured `json:"trialSpec,omitempty"` | ||
|
||
// Name of config map where Trial template is located | ||
ConfigMapName string `json:"configMapName,omitempty"` |
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.
The field is already in GoTemplate, should we remove it here?
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.
Yeah, but I think when we implement new logic we will not support GoTemplate
?
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.
SGTM, then can we just remove gotemplate?
Retain bool `json:"retain,omitempty"` | ||
// Retain indicates that Trial resources must be not cleanup | ||
Retain bool `json:"retain,omitempty"` | ||
|
||
GoTemplate *GoTemplate `json:"goTemplate,omitempty"` |
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.
Can we move it into TrialSpec?
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.
In that case what do you think about the name where Unstructured
template will be located?
type TrialSpec struct {
<must be some name> *unstructured.Unstructured `json:"<name>,omitempty"`
ConfigMapName string `json:"configMapName,omitempty"`
ConfigMapNamespace string `json:"configMapNamespace,omitempty"`
TemplatePath string `json:"templatePath,omitempty"`
}
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.
How about this (learn from https://github.com/kubernetes/api/blob/master/core/v1/types.go#L51):
type TrialTemplate struct {
Retain bool `json:"retain,omitempty"`
TrialSource `json:",inline"`
// List of parameres that are used in Trial template
TrialParameters []TrialParameterSpec `json:"trialParameters,omitempty"`
}
type TrialSource struct {
ConfigMap *ConfigMapSource `json:"configMap"`
TrialSpec *unstructured.Unstructured `json:"trialSpec"`
}
type ConfigMapSource struct {
// Name of config map where Trial template is located
ConfigMapName string `json:"configMapName,omitempty"`
// Namespace of config map where Trial template is located
ConfigMapNamespace string `json:"configMapNamespace,omitempty"`
// Path in config map where Trial template is located
TemplatePath string `json:"templatePath,omitempty"`
}
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.
@gaocegege SGTM, it is nice to follow k8s APIs structure way.
What do you think @johnugeorge ?
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.
Looks great
Generally, it looks great to me. Will we deprecate |
Retain bool `json:"retain,omitempty"` | ||
// Retain indicates that Trial resources must be not cleanup | ||
Retain bool `json:"retain,omitempty"` | ||
|
||
GoTemplate *GoTemplate `json:"goTemplate,omitempty"` |
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.
Are we supporting Gotemplate also?
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.
All current examples in v1beta1 are working with GoTemplate
.
You think we should remove it and don't run e2e test until we implement new logic?
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.
I think we should remove and disable test if we decide to remove it.
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.
I agree. Lets make all changes to trial template API in a single PR for better tracking . Once new TrialTemplate implementation is added, move all examples to new trial template.
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.
Ok, I will remove GoTemplate
in this PR and disable all e2e tests.
Thanks. I think we can deprecate it, when we implement new logic. Can't find any case when |
Great to see this coming along. I'll let the Katib experts review this. |
Remove GoTemplate from Experiment API
If we delete We need to fix problems in API package, for example: https://github.com/andreyvelich/katib/blob/new-trial-template-api/pkg/apis/controller/experiments/v1beta1/experiment_defaults.go#L57. So maybe we can delete What do you think @gaocegege @johnugeorge ? |
I am not sure why. I think v1alpha3 is decoupled with v1beta1. |
I think the problem is with this: https://github.com/kubeflow/katib/blob/master/pkg/apis/controller/addtoscheme_katib_v1beta1.go#L26-L29. So the solution can be comment the lines for v1beta1, from Then, I can build image for v1alpha3. |
1868e6b
to
59ea302
Compare
Implement new Trial Template to controller
Fix experiment defaults change valid/invalid experiment
I commited changes for the controller and examples in this PR to avoid problems in testing.
I think it is ready for review. |
if err = r.createTrialInstance(instance, &trial); err != nil { | ||
logger.Error(err, "Create trial instance error", "trial", trial) | ||
continue | ||
trialNames = append(trialNames, trial.Name) |
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.
I think this paragraph can be simplified to
for _, trial := range trials {
if err = r.createTrialInstance(instance, &trial); err != nil {
logger.Error(err, "Create trial instance error", "trial", trial)
continue
}
}
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.
In that case we try to create trials even if trials==[ ]
. Is that correct?
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.
@andreyvelich If trials == []
, the foreach loop will be skipped?
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.
@sperlingxx Thanks, I got your point. Will make change.
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.
/lgtm
Thanks for your contribution! 🎉 👍
/lgtm /assign @sperlingxx @johnugeorge |
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.
/lgtm
Great contribution!
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johnugeorge 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:
Approvers can indicate their approval by writing |
So excited about this!! 🎉 |
* Add new Trial Template API * Add TrialSource in TrialTemplate Remove GoTemplate from Experiment API * Add init logic for new trial template * Change examples Implement new Trial Template to controller * Modify trial template configMap for new version of Trial Template Fix experiment defaults change valid/invalid experiment * Run gofmt * Fix hyperband * Remove num-epochs from grid example * Add tag to file mc example * Modify create Trials loop
This is new API for Trial Template.
See comment: #906 (comment).
In
TrialParameters
user must define parameters that are replaced in Trial Template.As @gaocegege proposed, I added
Reference
to make connection betweenTrialParameters
andParameters
(search space).Also, in
TrialSpec
metadata.name
andmetadata.namespace
must be omitted, since we automatically added it in Katib controller.I added ConfigMap specification to
TrialTemplate
, if user wants to read Trial Template from configMap.In the future, we can extend
TrialTemplate
with custom settings (for example, how to get succeeded state of the Job), to support any Kubernetes CRDs.In this CRDs we should be able to run TrialJobs, such as Argo, etc (#1081).
/assign @gaocegege @jlewi @johnugeorge @sperlingxx
/cc @czheng94 @terrykong @nielsmeima