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

Update util for experiment in v1alpha2 #485

Conversation

andreyvelich
Copy link
Member

@andreyvelich andreyvelich commented May 3, 2019

I added new functions in Experiment util. After that, we can get new 2 conditions of Experiment and get current condition type of Experiment.
I will use it in the UI.


This change is Reviewable

@andreyvelich
Copy link
Member Author

/assign @johnugeorge
/cc @richardsliu @hougangliu

func (exp *Experiment) IsCompleted() bool {
return exp.IsSucceeded() || exp.IsFailed()
}

func (exp *Experiment) GetCurrentConditionType() ExperimentConditionType {
if exp.IsCreated() {
Copy link
Member

Choose a reason for hiding this comment

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

What would this function used for? If you want the latest condition, it would be better to directly lookup the Type of the last status.conditions?

Copy link
Member Author

@andreyvelich andreyvelich May 4, 2019

Choose a reason for hiding this comment

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

Is that true, that the latest Condition in this array: https://github.com/kubeflow/katib/blob/master/pkg/api/operators/apis/experiment/v1alpha2/experiment_types.go#L77, will be current?
I need to get Current Condition of Experiment.

func (exp *Experiment) IsCompleted() bool {
return exp.IsSucceeded() || exp.IsFailed()
}

func (exp *Experiment) GetCurrentConditionType() ExperimentConditionType {
Copy link
Member

Choose a reason for hiding this comment

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

it will always return ExperimentCreated, I don't think you except it

Copy link
Member Author

Choose a reason for hiding this comment

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

@hougangliu We can leave here only Succeeded or Failed or Running or Restarting condition. I think, for 1 experiment it can be one of the 4 conditions at the same time, isn't it?

Copy link
Member

Choose a reason for hiding this comment

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

I mean exp.IsCreated() will always true

Copy link
Member Author

Choose a reason for hiding this comment

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

What will happen in that situation:
Experiment ran and after that failed
Experiment restarted
Experiment is running again.
Will exp.IsRunning() and exp.IsFailed() return true ?

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding, the exp.Status.Conditions is a history of conditions of the experiment. So the exp.IsCreated() will be always true.
The last value of exp.Status.Conditions is the latest condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

@YujiOshima @hougangliu Ok, thank you! I changed this function to get the latest condition, please , take a look. In the UI, where we monitor experiments, I think, we should show the latest condition.

func (exp *Experiment) IsCompleted() bool {
return exp.IsSucceeded() || exp.IsFailed()
}

func (exp *Experiment) GetLastConditionType() ExperimentConditionType {
Copy link
Member

Choose a reason for hiding this comment

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

just for safe, we'd better guard len(exp.Status.Conditions) > 0 before below

Copy link
Member Author

Choose a reason for hiding this comment

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

@hougangliu Added, with an additional error, if Experiment doesn't have any Condition.

@hougangliu
Copy link
Member

/lgtm
thanks!

@johnugeorge
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link

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

@johnugeorge
Copy link
Member

/retest

4 similar comments
@johnugeorge
Copy link
Member

/retest

@andreyvelich
Copy link
Member Author

/retest

@andreyvelich
Copy link
Member Author

/retest

@andreyvelich
Copy link
Member Author

/retest

@hougangliu
Copy link
Member

hougangliu commented May 9, 2019

@andreyvelich I think you can try to rebase upstream to include #489 to fix test error

@k8s-ci-robot k8s-ci-robot removed the lgtm label May 9, 2019
@andreyvelich
Copy link
Member Author

@hougangliu Thanks, done.

@andreyvelich
Copy link
Member Author

/lgtm

@k8s-ci-robot
Copy link

@andreyvelich: you cannot LGTM your own PR.

In response to this:

/lgtm

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.

@andreyvelich
Copy link
Member Author

@richardsliu @hougangliu Please, lgtm this PR again.

@hougangliu
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot merged commit 7cadd62 into kubeflow:master May 9, 2019
@andreyvelich andreyvelich deleted the v1alpha2-update-util-experiment-condition branch October 6, 2021 00:23
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