Skip to content

Commit

Permalink
chore: improve comment
Browse files Browse the repository at this point in the history
Signed-off-by: toyamagu-2021 <toyamagu2021@gmail.com>
  • Loading branch information
toyamagu-2021 committed Oct 9, 2023
1 parent 847a341 commit 64af803
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 35 deletions.
4 changes: 3 additions & 1 deletion api/jsonschema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.|
Expand Down Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/workflow/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pkg/apis/workflow/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"`
}
4 changes: 2 additions & 2 deletions sdks/java/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdks/python/client/docs/IoArgoprojWorkflowV1alpha1NodeFlag.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 17 additions & 14 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand All @@ -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
}

0 comments on commit 64af803

Please sign in to comment.