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

Add condition logic code #504

Merged
merged 1 commit into from
Mar 26, 2018
Merged

Conversation

ScorpioCPH
Copy link
Member

@ScorpioCPH ScorpioCPH commented Mar 26, 2018

Hi, this PR add the condition logic without UT.

@jlewi @gaocegege @yph152 @DjangoPeng @ddysher PTAL, thank!


This change is Reviewable

@ScorpioCPH
Copy link
Member Author

Fixes #502.

@ScorpioCPH
Copy link
Member Author

/assign @gaocegege

newTFJob := tfjob.DeepCopy()
now := metav1.Now()
newTFJob.Status.StartTime = &now
err := tc.updateTFJobConditions(newTFJob, tfv1alpha2.TFJobCreated, tfJobCreatedReason, msg)
Copy link
Member

Choose a reason for hiding this comment

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

LGTM but maybe I will change the code here for test purpose. Handler based implementation is more test friendly

Copy link
Member

Choose a reason for hiding this comment

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

Oh my fault, LGTM without any comment.

Copy link
Member

Choose a reason for hiding this comment

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

Oh my fault, LGTM without any comment.

func (tc *TFJobController) updateTFJobConditions(tfjob *tfv1alpha2.TFJob, conditionType tfv1alpha2.TFJobConditionType, reason, message string) error {
condition := newCondition(conditionType, reason, message)
setCondition(&tfjob.Status, condition)
err := tc.updateStatusHandler(tfjob)
Copy link
Member

Choose a reason for hiding this comment

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

updateStatusHandler will be called in reconcile then is it necessary here?

@gaocegege
Copy link
Member

Generally LGTM! Thanks for your contribution! @yph152 PTAL

@yph152
Copy link
Contributor

yph152 commented Mar 26, 2018

generally LGTM!Thanks for your contribution!

@gaocegege
Copy link
Member

pkg/controller/controller.go:67:2:warning: unused variable or constant tfJobFailedReason (varcheck)

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: gaocegege

Assign the PR to them by writing /assign @gaocegege in a comment when ready.

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

@gaocegege gaocegege merged commit 5b7c417 into kubeflow:v1alpha2 Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants