diff --git a/api/jsonschema/schema.json b/api/jsonschema/schema.json index 93410f841fbd..aac83e9b660e 100644 --- a/api/jsonschema/schema.json +++ b/api/jsonschema/schema.json @@ -5467,9 +5467,11 @@ "io.argoproj.workflow.v1alpha1.NodeFlag": { "properties": { "hooked": { + "description": "Hooked tracks whether or not this node was triggered by hook or onExit", "type": "boolean" }, "retried": { + "description": "Retried tracks whether or not this node was retried by retryStrategy", "type": "boolean" } }, @@ -5548,7 +5550,7 @@ }, "nodeFlag": { "$ref": "#/definitions/io.argoproj.workflow.v1alpha1.NodeFlag", - "description": "Retried tracks whether or not this node was retried by retryStrategy" + "description": "NodeFlag tracks some history of node. e.g.) hooked, retried, etc." }, "outboundNodes": { "description": "OutboundNodes tracks the node IDs which are considered \"outbound\" nodes to a template invocation. For every invocation of a template, there are nodes which we considered as \"outbound\". Essentially, these are last nodes in the execution sequence to run, before the template is considered completed. These nodes are then connected as parents to a following step.\n\nIn the case of single pod steps (i.e. container, script, resource templates), this list will be nil since the pod itself is already considered the \"outbound\" node. In the case of DAGs, outbound nodes are the \"target\" tasks (tasks with no children). In the case of steps, outbound nodes are all the containers involved in the last step group. NOTE: since templates are composable, the list of outbound nodes are carried upwards when a DAG/steps template invokes another DAG/steps template. In other words, the outbound nodes of a template, will be a superset of the outbound nodes of its last children.", diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index e5b7a5753d57..ff2f319fe588 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -9408,9 +9408,11 @@ "type": "object", "properties": { "hooked": { + "description": "Hooked tracks whether or not this node was triggered by hook or onExit", "type": "boolean" }, "retried": { + "description": "Retried tracks whether or not this node was retried by retryStrategy", "type": "boolean" } } @@ -9493,7 +9495,7 @@ "type": "string" }, "nodeFlag": { - "description": "Retried tracks whether or not this node was retried by retryStrategy", + "description": "NodeFlag tracks some history of node. e.g.) hooked, retried, etc.", "$ref": "#/definitions/io.argoproj.workflow.v1alpha1.NodeFlag" }, "outboundNodes": { diff --git a/docs/fields.md b/docs/fields.md index a579094af0c5..4b8f4d2be476 100644 --- a/docs/fields.md +++ b/docs/fields.md @@ -1812,7 +1812,7 @@ NodeStatus contains status information about an individual node in the workflow |`memoizationStatus`|[`MemoizationStatus`](#memoizationstatus)|MemoizationStatus holds information about cached nodes| |`message`|`string`|A human readable message indicating details about why the node is in this condition.| |`name`|`string`|Name is unique name in the node tree used to generate the node ID| -|`nodeFlag`|[`NodeFlag`](#nodeflag)|Retried tracks whether or not this node was retried by retryStrategy| +|`nodeFlag`|[`NodeFlag`](#nodeflag)|NodeFlag tracks some history of node. e.g.) hooked, retried, etc.| |`outboundNodes`|`Array< string >`|OutboundNodes tracks the node IDs which are considered "outbound" nodes to a template invocation. For every invocation of a template, there are nodes which we considered as "outbound". Essentially, these are last nodes in the execution sequence to run, before the template is considered completed. These nodes are then connected as parents to a following step. In the case of single pod steps (i.e. container, script, resource templates), this list will be nil since the pod itself is already considered the "outbound" node. In the case of DAGs, outbound nodes are the "target" tasks (tasks with no children). In the case of steps, outbound nodes are all the containers involved in the last step group. NOTE: since templates are composable, the list of outbound nodes are carried upwards when a DAG/steps template invokes another DAG/steps template. In other words, the outbound nodes of a template, will be a superset of the outbound nodes of its last children.| |`outputs`|[`Outputs`](#outputs)|Outputs captures output parameter values and artifact locations produced by this template invocation| |`phase`|`string`|Phase a simple, high-level summary of where the node is in its lifecycle. Can be used as a state machine. Will be one of these values "Pending", "Running" before the node is completed, or "Succeeded", "Skipped", "Failed", "Error", or "Omitted" as a final state.| @@ -3210,8 +3210,8 @@ _No description available_ ### Fields | Field Name | Field Type | Description | |:----------:|:----------:|---------------| -|`hooked`|`boolean`|_No description available_| -|`retried`|`boolean`|_No description available_| +|`hooked`|`boolean`|Hooked tracks whether or not this node was triggered by hook or onExit| +|`retried`|`boolean`|Retried tracks whether or not this node was retried by retryStrategy| ## NodeSynchronizationStatus diff --git a/pkg/apis/workflow/v1alpha1/generated.proto b/pkg/apis/workflow/v1alpha1/generated.proto index bef8b90fd405..9421a898d9ed 100644 --- a/pkg/apis/workflow/v1alpha1/generated.proto +++ b/pkg/apis/workflow/v1alpha1/generated.proto @@ -976,8 +976,10 @@ message MutexStatus { } message NodeFlag { + // Hooked tracks whether or not this node was triggered by hook or onExit optional bool hooked = 1; + // Retried tracks whether or not this node was retried by retryStrategy optional bool retried = 2; } @@ -1050,7 +1052,7 @@ message NodeStatus { // Daemoned tracks whether or not this node was daemoned and need to be terminated optional bool daemoned = 13; - // Retried tracks whether or not this node was retried by retryStrategy + // NodeFlag tracks some history of node. e.g.) hooked, retried, etc. optional NodeFlag nodeFlag = 27; // Inputs captures input parameter values and artifact locations supplied to this template invocation diff --git a/pkg/apis/workflow/v1alpha1/openapi_generated.go b/pkg/apis/workflow/v1alpha1/openapi_generated.go index 2b12a2ed85e0..37c93e7e7e51 100644 --- a/pkg/apis/workflow/v1alpha1/openapi_generated.go +++ b/pkg/apis/workflow/v1alpha1/openapi_generated.go @@ -3954,14 +3954,16 @@ func schema_pkg_apis_workflow_v1alpha1_NodeFlag(ref common.ReferenceCallback) co Properties: map[string]spec.Schema{ "hooked": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Description: "Hooked tracks whether or not this node was triggered by hook or onExit", + Type: []string{"boolean"}, + Format: "", }, }, "retried": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Description: "Retried tracks whether or not this node was retried by retryStrategy", + Type: []string{"boolean"}, + Format: "", }, }, }, @@ -4146,7 +4148,7 @@ func schema_pkg_apis_workflow_v1alpha1_NodeStatus(ref common.ReferenceCallback) }, "nodeFlag": { SchemaProps: spec.SchemaProps{ - Description: "Retried tracks whether or not this node was retried by retryStrategy", + Description: "NodeFlag tracks some history of node. e.g.) hooked, retried, etc.", Ref: ref("github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1.NodeFlag"), }, }, diff --git a/pkg/apis/workflow/v1alpha1/workflow_types.go b/pkg/apis/workflow/v1alpha1/workflow_types.go index 1ed49a2c4b56..514b01ba3fd3 100644 --- a/pkg/apis/workflow/v1alpha1/workflow_types.go +++ b/pkg/apis/workflow/v1alpha1/workflow_types.go @@ -2223,7 +2223,7 @@ type NodeStatus struct { // Daemoned tracks whether or not this node was daemoned and need to be terminated Daemoned *bool `json:"daemoned,omitempty" protobuf:"varint,13,opt,name=daemoned"` - // Retried tracks whether or not this node was retried by retryStrategy + // NodeFlag tracks some history of node. e.g.) hooked, retried, etc. NodeFlag *NodeFlag `json:"nodeFlag,omitempty" protobuf:"bytes,27,opt,name=nodeFlag"` // Inputs captures input parameter values and artifact locations supplied to this template invocation @@ -3824,6 +3824,8 @@ type NodeSynchronizationStatus struct { } type NodeFlag struct { - Hooked bool `json:"hooked,omitempty" protobuf:"varint,1,opt,name=hooked"` + // Hooked tracks whether or not this node was triggered by hook or onExit + Hooked bool `json:"hooked,omitempty" protobuf:"varint,1,opt,name=hooked"` + // Retried tracks whether or not this node was retried by retryStrategy Retried bool `json:"retried,omitempty" protobuf:"varint,2,opt,name=retried"` } diff --git a/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md b/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md index 857d5b75e533..a948474ce45a 100644 --- a/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md +++ b/sdks/java/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md @@ -7,8 +7,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**hooked** | **Boolean** | | [optional] -**retried** | **Boolean** | | [optional] +**hooked** | **Boolean** | Hooked tracks whether or not this node was triggered by hook or onExit | [optional] +**retried** | **Boolean** | Retried tracks whether or not this node was retried by retryStrategy | [optional] diff --git a/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_node_flag.py b/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_node_flag.py index e4057ebc8e58..f9225e196e42 100644 --- a/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_node_flag.py +++ b/sdks/python/client/argo_workflows/model/io_argoproj_workflow_v1alpha1_node_flag.py @@ -136,8 +136,8 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - hooked (bool): [optional] # noqa: E501 - retried (bool): [optional] # noqa: E501 + hooked (bool): Hooked tracks whether or not this node was triggered by hook or onExit. [optional] # noqa: E501 + retried (bool): Retried tracks whether or not this node was retried by retryStrategy. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -219,8 +219,8 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - hooked (bool): [optional] # noqa: E501 - retried (bool): [optional] # noqa: E501 + hooked (bool): Hooked tracks whether or not this node was triggered by hook or onExit. [optional] # noqa: E501 + retried (bool): Retried tracks whether or not this node was retried by retryStrategy. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md b/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md index f9c95091bc53..f9113f86d045 100644 --- a/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md +++ b/sdks/python/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md @@ -4,8 +4,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**hooked** | **bool** | | [optional] -**retried** | **bool** | | [optional] +**hooked** | **bool** | Hooked tracks whether or not this node was triggered by hook or onExit | [optional] +**retried** | **bool** | Retried tracks whether or not this node was retried by retryStrategy | [optional] **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/workflow/controller/operator.go b/workflow/controller/operator.go index 253388431660..48241371853a 100644 --- a/workflow/controller/operator.go +++ b/workflow/controller/operator.go @@ -1726,20 +1726,6 @@ func getChildNodeIndex(node *wfv1.NodeStatus, nodes wfv1.Nodes, index int) *wfv1 return &lastChildNode } -func getChildNodeIdsRetried(node *wfv1.NodeStatus, nodes wfv1.Nodes) []string { - childrenIds := []string{} - for i := 0; i < len(node.Children); i++ { - n := getChildNodeIndex(node, nodes, i) - if n == nil || n.NodeFlag == nil { - continue - } - if n.NodeFlag.Retried { - childrenIds = append(childrenIds, n.ID) - } - } - return childrenIds -} - func getRetryNodeChildrenIds(node *wfv1.NodeStatus, nodes wfv1.Nodes) []string { // A fulfilled Retry node will always reflect the status of its last child node, so its individual attempts don't interest us. // To resume the traversal, we look at the children of the last child node and of any on exit nodes. @@ -3973,6 +3959,8 @@ func setWfPodNamesAnnotation(wf *wfv1.Workflow) { wf.Annotations[common.AnnotationKeyPodNameVersion] = podNameVersion.String() } +// getChildNodeIdsAndLastRetriedNode returns child node ids and last retried node for parant noode `NodeType: Retry`. +// This function removes some unnecessary child nodes, such as hooked nodes. func getChildNodeIdsAndLastRetriedNode(node *wfv1.NodeStatus, nodes wfv1.Nodes) ([]string, *wfv1.NodeStatus) { childNodeIds := getChildNodeIdsRetried(node, nodes) @@ -3986,3 +3974,18 @@ func getChildNodeIdsAndLastRetriedNode(node *wfv1.NodeStatus, nodes wfv1.Nodes) } return childNodeIds, lastChildNode } + +// getChildNodeIdsRetried returns child node ids which have `NodeStatus.NodeFlag.Retried` set to true. +func getChildNodeIdsRetried(node *wfv1.NodeStatus, nodes wfv1.Nodes) []string { + childrenIds := []string{} + for i := 0; i < len(node.Children); i++ { + n := getChildNodeIndex(node, nodes, i) + if n == nil || n.NodeFlag == nil { + continue + } + if n.NodeFlag.Retried { + childrenIds = append(childrenIds, n.ID) + } + } + return childrenIds +}