From 42cad9b1930c55ac2adda473a40f1faf6b288688 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sat, 1 Jun 2024 05:49:38 +1000 Subject: [PATCH 1/3] feat: SKIP_WORKFLOW_DURATION_ESTIMATION Fixes https://github.com/argoproj/argo-workflows/issues/7271 --- workflow/controller/estimation/estimator_factory.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/workflow/controller/estimation/estimator_factory.go b/workflow/controller/estimation/estimator_factory.go index 984e76d98cdc..a90b929e7644 100644 --- a/workflow/controller/estimation/estimator_factory.go +++ b/workflow/controller/estimation/estimator_factory.go @@ -9,6 +9,7 @@ import ( "github.com/argoproj/argo-workflows/v3/persist/sqldb" wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" + "github.com/argoproj/argo-workflows/v3/util/env" "github.com/argoproj/argo-workflows/v3/server/utils" "github.com/argoproj/argo-workflows/v3/workflow/common" "github.com/argoproj/argo-workflows/v3/workflow/controller/indexes" @@ -29,12 +30,21 @@ type estimatorFactory struct { var _ EstimatorFactory = &estimatorFactory{} +var ( + skipWorkflowDurationEstimation = env.LookupEnvStringOr("SKIP_WORKFLOW_DURATION_ESTIMATION", "false") +) + func NewEstimatorFactory(wfInformer cache.SharedIndexInformer, hydrator hydrator.Interface, wfArchive sqldb.WorkflowArchive) EstimatorFactory { return &estimatorFactory{wfInformer, hydrator, wfArchive} } func (f *estimatorFactory) NewEstimator(wf *wfv1.Workflow) (Estimator, error) { defaultEstimator := &estimator{wf: wf} + + if skipWorkflowDurationEstimation == "true" { + return defaultEstimator, nil + } + for labelName, indexName := range map[string]string{ common.LabelKeyWorkflowTemplate: indexes.WorkflowTemplateIndex, common.LabelKeyClusterWorkflowTemplate: indexes.ClusterWorkflowTemplateIndex, From ba4f9d6071de217b4f084b70eb331fc3b20fc1c8 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sat, 1 Jun 2024 06:52:19 +1000 Subject: [PATCH 2/3] Update environment-variables.md --- docs/environment-variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 8237692361b3..99b57499a741 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -54,6 +54,7 @@ This document outlines environment variables that can be used to customize behav | `WORKFLOW_GC_PERIOD` | `time.Duration` | `5m` | The periodicity for GC of workflows. | | `SEMAPHORE_NOTIFY_DELAY` | `time.Duration` | `1s` | Tuning Delay when notifying semaphore waiters about availability in the semaphore | | `WATCH_CONTROLLER_SEMAPHORE_CONFIGMAPS` | `bool` | `true` | Whether to watch the Controller's ConfigMap and semaphore ConfigMaps for run-time changes. When disabled, the Controller will only read these ConfigMaps once and will have to be manually restarted to pick up new changes. | +| `SKIP_WORKFLOW_DURATION_ESTIMATION` | `bool` | `false` | Whether to lookup resource usage from prior workflows as a basis for estimating resource usage on a new workflow. | CLI parameters of the Controller can be specified as environment variables with the `ARGO_` prefix. For example: From 32a81ac478896363017b58a945512c4c9783fdff Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Sat, 1 Jun 2024 07:13:12 +1000 Subject: [PATCH 3/3] Update estimator_factory.go --- workflow/controller/estimation/estimator_factory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/controller/estimation/estimator_factory.go b/workflow/controller/estimation/estimator_factory.go index a90b929e7644..1b6e7b4041e6 100644 --- a/workflow/controller/estimation/estimator_factory.go +++ b/workflow/controller/estimation/estimator_factory.go @@ -9,8 +9,8 @@ import ( "github.com/argoproj/argo-workflows/v3/persist/sqldb" wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" - "github.com/argoproj/argo-workflows/v3/util/env" "github.com/argoproj/argo-workflows/v3/server/utils" + "github.com/argoproj/argo-workflows/v3/util/env" "github.com/argoproj/argo-workflows/v3/workflow/common" "github.com/argoproj/argo-workflows/v3/workflow/controller/indexes" "github.com/argoproj/argo-workflows/v3/workflow/hydrator"