forked from argoproj/argo-workflows
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(controller): Estimate workflow duration. Fixes argoproj#2717
- Loading branch information
Showing
50 changed files
with
1,614 additions
and
610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Estimated Duration | ||
|
||
![alpha](assets/alpha.svg) | ||
|
||
> v2.12 and after | ||
When you run a workflow, the controller will try to estimate its duration. | ||
|
||
This is based on the most recently successful workflow submitted from the same workflow template, cluster workflow template or cron workflow. | ||
|
||
To get this data, the controller queries the Kubernetes API first (as this is faster) and then [workflow archive](workflow-archive.md) (if enabled). | ||
|
||
If you've used tools like Jenkins, you'll know that that estimates can be inaccurate: | ||
|
||
* A pod spent a long amount of time pending scheduling. | ||
* The workflow is non-deterministic, e.g. it uses `when` to execute different paths. | ||
* The workflow can vary is scale, e.g. sometimes it uses `withItems` and so sometimes run 100 nodes, sometimes a 1000. | ||
* If the pod runtimes are unpredictable. | ||
* The workflow is parameterized, and different parameters affect its duration. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package v1alpha1 | ||
|
||
import "time" | ||
|
||
// EstimatedDuration is in seconds. | ||
type EstimatedDuration int | ||
|
||
func (d EstimatedDuration) ToDuration() time.Duration { | ||
return time.Second * time.Duration(d) | ||
} | ||
|
||
func NewEstimatedDuration(d time.Duration) EstimatedDuration { | ||
return EstimatedDuration(d.Seconds()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestEstimatedDuration(t *testing.T) { | ||
duration := NewEstimatedDuration(time.Minute) | ||
assert.Equal(t, EstimatedDuration(60), duration) | ||
assert.Equal(t, time.Duration(time.Minute), duration.ToDuration()) | ||
} |
Oops, something went wrong.