-
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
support trial meta injection in trial template rendering #1259
support trial meta injection in trial template rendering #1259
Conversation
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
/assign @andreyvelich
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.
Thanks @sperlingxx.
I agree that Trial name and namespace might be useful for some cases.
Maybe we could include these parameters to TrialParameters and user can explicitly see which parameters will be replaced in TrialSpec?
I propose to name these parameters: TrialName
and TrialNamespace
to not block TrialParameters[].Name = "Name"
. Maybe one of the training container input parameter is Neural Network name. For example, user has various NN names and wants to find which is the best.
For these parameters, we should change Reference. My suggestion is: ${trialSpec.metadata.name}
or ${trialSpec.name}
. So user can certain see how this parameter will be replaced.
What do you think @sperlingxx @gaocegege ?
${trialSpec.metadata.name} or ${trialSpec.name} LGTM. |
@andreyvelich @gaocegege I just back from vacation. For me, using |
92ead2c
to
310869b
Compare
@andreyvelich @gaocegege I think this PR is ready. After refactoring, mapping relation between placeholder (reference) of trial metadata and trial metadata is defined by buildTrialMetaForRunSpec. |
@sperlingxx Thank you for updating this! So my suggestion is having something like this: trialTemplate:
trialParameters:
- name: learningRate
description: Learning rate for the training model
reference: lr
- name: trialName
description: Name of the Trial
reference: ${trialSpec.metadata.name}
- name: trialNamespace
description: Namespace of the Trial
reference: ${trialSpec.metadata.namespace}
- name: trialKind
description: Kind of the Trial
reference: ${trialSpec.kind}
- name: trialAPIVersion
description: API Version of the Trial
reference: ${trialSpec.apiVersion}
trialSpec:
apiVersion: batch/v1
kind: Job
spec:
template:
spec:
containers:
- name: training-container
image: docker.io/kubeflowkatib/mxnet-mnist
command:
- "python3"
- "/opt/mxnet-mnist/mnist.py"
- "--batch-size=64"
- "--lr=${trialParameters.learningRate}"
env:
- name: Name
value: ${trialParameters.trialName}
- name: Namespace
value: ${trialParameters.trialNamespace}
- name: Kind
value: ${trialParameters.trialKind}
- name: APIVersion
value: ${trialParameters.trialAPIVersion}
restartPolicy: Never Advantages of this approach:
...
- name: katibTrialName
description: Name of the Trial
reference: ${trialSpec.metadata.name}
...
env:
- name: Name
value: ${trialParameters.katibTrialName}
... What do you think @sperlingxx @gaocegege @johnugeorge ? Tekton also uses substitution from params (https://github.com/tektoncd/pipeline/blob/master/examples/v1beta1/pipelineruns/pipelinerun-with-params.yaml#L1-L29). |
@andreyvelich I misunderstood the meaning of
|
@sperlingxx |
@andreyvelich Generally, I agree with that. And in latest commit, I have applied trial meta by reference approach with the style I proposed above. |
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 Thank you very much for updating this!
I left few comments.
@@ -7,88 +7,88 @@ package mock | |||
import ( | |||
context "context" | |||
gomock "github.com/golang/mock/gomock" | |||
v1alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" | |||
api_v1_alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" |
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.
Do you know, which version of mockgen are you using?
Why it is updated few naming ?
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 believe I use the master branch of mockgen.
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.
Thanks @sperlingxx.
/lgtm
/cc @gaocegege @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
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andreyvelich 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 |
After the refactor of trial template rendering in v1beta1, users can only fetch nothing but hyperparameter values. But, in v1alpha3, users can fetch trial name via placeholder (
{{.Trial}}
), which is quite useful in many conditions, such as appending it at the end of model storage url/path to avoid model overwriting.This PR is trying to bring this feature back through additional trial template transformation, which is specialized for metadata injection.
cc @andreyvelich @gaocegege @johnugeorge