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. DetailsIn 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.
The field is already in GoTemplate, should we remove it here?
There was a problem hiding this comment.
Yeah, but I think when we implement new logic we will not support GoTemplate ?
There was a problem hiding this comment.
SGTM, then can we just remove gotemplate?
| // 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.
Can we move it into TrialSpec?
There was a problem hiding this comment.
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.
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.
@gaocegege SGTM, it is nice to follow k8s APIs structure way.
What do you think @johnugeorge ?
|
Generally, it looks great to me. Will we deprecate |
| // 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.
Are we supporting Gotemplate also?
There was a problem hiding this comment.
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.
I think we should remove and disable test if we decide to remove it.
There was a problem hiding this comment.
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.
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.
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.
In that case we try to create trials even if trials==[ ] . Is that correct?
There was a problem hiding this comment.
@andreyvelich If trials == [], the foreach loop will be skipped?
There was a problem hiding this comment.
@sperlingxx Thanks, I got your point. Will make change.
gaocegege
left a comment
There was a problem hiding this comment.
/lgtm
Thanks for your contribution! 🎉 👍
|
/lgtm /assign @sperlingxx @johnugeorge |
|
/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 DetailsNeeds 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
TrialParametersuser must define parameters that are replaced in Trial Template.As @gaocegege proposed, I added
Referenceto make connection betweenTrialParametersandParameters(search space).Also, in
TrialSpecmetadata.nameandmetadata.namespacemust 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
TrialTemplatewith 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