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

feat: Allow AnalysisRun to complete an experiment #345

Merged
merged 3 commits into from
Jan 10, 2020
Merged

Conversation

dthomson25
Copy link
Member

closes #248

@codecov
Copy link

codecov bot commented Jan 6, 2020

Codecov Report

Merging #345 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
+ Coverage   84.04%   84.14%   +0.09%     
==========================================
  Files          66       66              
  Lines        6055     6072      +17     
==========================================
+ Hits         5089     5109      +20     
+ Misses        689      688       -1     
+ Partials      277      275       -2
Impacted Files Coverage Δ
utils/experiment/experiment.go 93.04% <100%> (+0.81%) ⬆️
experiments/experiment.go 93.23% <100%> (+0.12%) ⬆️
experiments/replicaset.go 83.87% <0%> (+2.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7dfa6bb...e666bbf. Read the comment docs.

@@ -201,4 +203,6 @@ type ExperimentAnalysisRunStatus struct {
Phase AnalysisPhase `json:"phase"`
// Message is a message explaining the current status
Message string `json:"message,omitempty"`
// RequiredForCompletion indicates that experiment should complete after analysis finishes
RequiredForCompletion bool `json:"requiredForCompletion,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I feel we don't need to duplicate RequiredForCompletion in the status for this structure. Can't this be inferred from the ExperimentAnalysisTemplateRef?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, fair point.

for _, a := range ec.ex.Spec.Analyses {
as := experimentutil.GetAnalysisRunStatus(*ec.newStatus, a.Name)
if as.RequiredForCompletion && as.Phase == v1alpha1.AnalysisPhaseSuccessful {
requiredAnalysisRunCompleted = true
Copy link
Member

@jessesuen jessesuen Jan 7, 2020

Choose a reason for hiding this comment

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

I think theres a bug here. This will set requiredAnalysisRunCompleted to be true as soon as any one of the required runs completes, but not all. I think this should be reversed to initialize as true and set it to false as soon as one required run is still not complete.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

utils/experiment/experiment.go Show resolved Hide resolved
@@ -380,6 +385,9 @@ func (ec *experimentContext) calculateStatus() *v1alpha1.ExperimentStatus {
// We will now fail the experiment.
ec.newStatus.Phase = analysesStatus
ec.newStatus.Message = analysesMessage
} else if analysesMessage == requiredAnalysisCompletedMessage {
Copy link
Member

Choose a reason for hiding this comment

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

I think comparing the message against a well known message seems too magical. Is the point of this code to bubble up a better reason for a running experiment?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a fair point. No, the purpose of this code is to provide a way to mark an experiment successful if the required analysis runs are completed. Since we shouldn't mark the experiment successful if the analysis is successful but not required, the magic string makes it easy to determine that case. Can you take another look?

}

// CompletedAllRequiredAnalysisRuns has at least one required for completition analysis run
// and it completed successfully
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this to: RequiredAnalysisRunsSuccessful() ? I didn't realize this would only only return when they were successful and not just completed.

@jessesuen
Copy link
Member

LGTM, but suggest to rename method

@dthomson25 dthomson25 merged commit c79494b into master Jan 10, 2020
@dthomson25 dthomson25 deleted the ar-complete-ex branch January 10, 2020 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a way to allow analyses to complete the experiment
2 participants