@@ -100,7 +100,7 @@ func (ec *experimentContext) reconcile() *v1alpha1.ExperimentStatus {
100
100
}
101
101
102
102
for _ , analysis := range ec .ex .Spec .Analyses {
103
- ec .reconcileAnalysisRun (analysis , ec .ex .Spec .DryRun )
103
+ ec .reconcileAnalysisRun (analysis , ec .ex .Spec .DryRun , ec . ex . Spec . MeasurementRetention )
104
104
}
105
105
106
106
newStatus := ec .calculateStatus ()
@@ -371,7 +371,7 @@ func calculateEnqueueDuration(ex *v1alpha1.Experiment, newStatus *v1alpha1.Exper
371
371
372
372
// reconcileAnalysisRun reconciles a single analysis run, creating or terminating it as necessary.
373
373
// Updates the analysis run statuses, which may subsequently fail the experiment.
374
- func (ec * experimentContext ) reconcileAnalysisRun (analysis v1alpha1.ExperimentAnalysisTemplateRef , dryRunMetrics []v1alpha1.DryRun ) {
374
+ func (ec * experimentContext ) reconcileAnalysisRun (analysis v1alpha1.ExperimentAnalysisTemplateRef , dryRunMetrics []v1alpha1.DryRun , measurementRetentionMetrics []v1alpha1. MeasurementRetention ) {
375
375
logCtx := ec .log .WithField ("analysis" , analysis .Name )
376
376
logCtx .Infof ("Reconciling analysis" )
377
377
prevStatus := experimentutil .GetAnalysisRunStatus (ec .ex .Status , analysis .Name )
@@ -427,7 +427,7 @@ func (ec *experimentContext) reconcileAnalysisRun(analysis v1alpha1.ExperimentAn
427
427
logCtx .Warnf ("Skipping AnalysisRun creation for analysis %s: experiment is terminating" , analysis .Name )
428
428
return
429
429
}
430
- run , err := ec .createAnalysisRun (analysis , dryRunMetrics )
430
+ run , err := ec .createAnalysisRun (analysis , dryRunMetrics , measurementRetentionMetrics )
431
431
if err != nil {
432
432
msg := fmt .Sprintf ("Failed to create AnalysisRun for analysis '%s': %v" , analysis .Name , err .Error ())
433
433
newStatus .Phase = v1alpha1 .AnalysisPhaseError
@@ -474,13 +474,13 @@ func (ec *experimentContext) reconcileAnalysisRun(analysis v1alpha1.ExperimentAn
474
474
// createAnalysisRun creates the analysis run. If an existing runs exists with same name, is
475
475
// semantically equal, and is not complete, returns the existing one, otherwise creates a new
476
476
// run with a collision counter increase.
477
- func (ec * experimentContext ) createAnalysisRun (analysis v1alpha1.ExperimentAnalysisTemplateRef , dryRunMetrics []v1alpha1.DryRun ) (* v1alpha1.AnalysisRun , error ) {
477
+ func (ec * experimentContext ) createAnalysisRun (analysis v1alpha1.ExperimentAnalysisTemplateRef , dryRunMetrics []v1alpha1.DryRun , measurementRetentionMetrics []v1alpha1. MeasurementRetention ) (* v1alpha1.AnalysisRun , error ) {
478
478
analysisRunIf := ec .argoProjClientset .ArgoprojV1alpha1 ().AnalysisRuns (ec .ex .Namespace )
479
479
args , err := ec .ResolveAnalysisRunArgs (analysis .Args )
480
480
if err != nil {
481
481
return nil , err
482
482
}
483
- run , err := ec .newAnalysisRun (analysis , args , dryRunMetrics )
483
+ run , err := ec .newAnalysisRun (analysis , args , dryRunMetrics , measurementRetentionMetrics )
484
484
if err != nil {
485
485
return nil , err
486
486
}
@@ -616,7 +616,7 @@ func (ec *experimentContext) assessAnalysisRuns() (v1alpha1.AnalysisPhase, strin
616
616
}
617
617
618
618
// newAnalysisRun generates an AnalysisRun from the experiment and template
619
- func (ec * experimentContext ) newAnalysisRun (analysis v1alpha1.ExperimentAnalysisTemplateRef , args []v1alpha1.Argument , dryRunMetrics []v1alpha1.DryRun ) (* v1alpha1.AnalysisRun , error ) {
619
+ func (ec * experimentContext ) newAnalysisRun (analysis v1alpha1.ExperimentAnalysisTemplateRef , args []v1alpha1.Argument , dryRunMetrics []v1alpha1.DryRun , measurementRetentionMetrics []v1alpha1. MeasurementRetention ) (* v1alpha1.AnalysisRun , error ) {
620
620
621
621
if analysis .ClusterScope {
622
622
clusterTemplate , err := ec .clusterAnalysisTemplateLister .Get (analysis .TemplateName )
@@ -626,7 +626,7 @@ func (ec *experimentContext) newAnalysisRun(analysis v1alpha1.ExperimentAnalysis
626
626
name := fmt .Sprintf ("%s-%s" , ec .ex .Name , analysis .Name )
627
627
628
628
clusterAnalysisTemplates := []* v1alpha1.ClusterAnalysisTemplate {clusterTemplate }
629
- run , err := analysisutil .NewAnalysisRunFromTemplates (nil , clusterAnalysisTemplates , args , dryRunMetrics , []v1alpha1. MeasurementRetention {} , name , "" , ec .ex .Namespace )
629
+ run , err := analysisutil .NewAnalysisRunFromTemplates (nil , clusterAnalysisTemplates , args , dryRunMetrics , measurementRetentionMetrics , name , "" , ec .ex .Namespace )
630
630
if err != nil {
631
631
return nil , err
632
632
}
@@ -644,7 +644,7 @@ func (ec *experimentContext) newAnalysisRun(analysis v1alpha1.ExperimentAnalysis
644
644
name := fmt .Sprintf ("%s-%s" , ec .ex .Name , analysis .Name )
645
645
646
646
analysisTemplates := []* v1alpha1.AnalysisTemplate {template }
647
- run , err := analysisutil .NewAnalysisRunFromTemplates (analysisTemplates , nil , args , dryRunMetrics , []v1alpha1. MeasurementRetention {} , name , "" , ec .ex .Namespace )
647
+ run , err := analysisutil .NewAnalysisRunFromTemplates (analysisTemplates , nil , args , dryRunMetrics , measurementRetentionMetrics , name , "" , ec .ex .Namespace )
648
648
if err != nil {
649
649
return nil , err
650
650
}
0 commit comments