Is there any way to determine the number of times an Argo workflowtemplate got executed? And referencing the current number of execution time inside the template.
Is there any way to determine the number of times an Argo workflowtemplate got executed? And referencing the current number of execution time inside the template.
Argo Workflows does not keep track of how many times a WorkflowTemplate has been executed. But that information might be in a couple other places.
First, the count might be in Kubernetes itself. When a Workflow is invoked as an instance of a WorkflowTemplate, the Workflow is labeled with the WorkflowTemplate name. So you can use kubectl to get the Workflows. However, this only works as a count if no one has deleted any of the Workflows, and there is no cleanup process running (as with Argo's TTL settings).
kubectl get workflows -l workflows.argoproj.io/workflow-template=whatever
Second, the count might be in a database. Argo Workflows has an optional archive which stores the JSON representation of each Workflow when it reaches TTL. If this is enabled, then the number of invocations is the sum of archived Workflows with the workflows.argoproj.io/workflow-template=whatever label and Workflows still on the cluster (not yet at TTL) with that label. Again, this count is only accurate if no one is manually deleting Workflows before they reach TTL.
If having an accurate count is absolutely critical, you should probably add a step to each of the Workflows to increment a counter in a database of some kind.