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

validate studyJob when first reconcile it #308

Merged
merged 2 commits into from
Dec 23, 2018
Merged

validate studyJob when first reconcile it #308

merged 2 commits into from
Dec 23, 2018

Conversation

hougangliu
Copy link
Member

@hougangliu hougangliu commented Dec 21, 2018

Fixes: #297


This change is Reviewable

@hougangliu
Copy link
Member Author

/assign @richardsliu @YujiOshima

@YujiOshima
Copy link
Contributor

@hougangliu Thanks!
/lgtm

@johnugeorge
Copy link
Member

it would be nice if some unit tests can be added for valid/invalid studyjob specs. May be, we can take this in a separate PR

@@ -30,3 +41,72 @@ func createWorkerJobObj(kind string) runtime.Object {
}
return nil
}

func generateRandid() string {
// UUID isn't quite handy in the Go world
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use something like this? https://godoc.org/github.com/google/uuid

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, sure. I can update it.

@@ -103,7 +103,7 @@ func getWorkerManifest(c katibapi.ManagerClient, studyID string, trial *katibapi
}
var wid string
if dryrun {
wid = "validation"
wid = generateRandid()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, if I don't change it, a worker template with Name "validation" will be taken as valid by mistake.

return err
}

studyID := generateRandid()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to generate id here if we are just validating the spec?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually studyId and trialID can be hard-code here for now. I can hard-code it here.
Thanks for your comment

@hougangliu
Copy link
Member Author

it would be nice if some unit tests can be added for valid/invalid studyjob specs. May be, we can take this in a separate PR

Sure, thanks

k8s.io/apimachinery/pkg/util/uuid is used in kubernetes source code
@k8s-ci-robot k8s-ci-robot removed the lgtm label Dec 22, 2018
@richardsliu
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: richardsliu

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 1295f45 into kubeflow:master Dec 23, 2018
@hougangliu hougangliu deleted the validate-studyjob branch December 23, 2018 23:19
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