Skip to content

Commit

Permalink
feat: Support argo plugin stop. Fixes #12333 (#12441)
Browse files Browse the repository at this point in the history
Signed-off-by: xin04.zhang <xin04.zhang@horizon.ai>
Co-authored-by: xin04.zhang <xin04.zhang@horizon.ai>
  • Loading branch information
GhangZh and GhangZh committed Jan 4, 2024
1 parent d68bbe4 commit c71e1dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2441,6 +2441,11 @@ func (n *NodeStatus) IsActiveSuspendNode() bool {
return n.Type == NodeTypeSuspend && n.Phase == NodeRunning
}

// IsActivePluginNode returns whether this node is an active plugin node
func (n *NodeStatus) IsActivePluginNode() bool {
return n.Type == NodeTypePlugin && (n.Phase == NodeRunning || n.Phase == NodePending)
}

func (n NodeStatus) GetDuration() time.Duration {
if n.FinishedAt.IsZero() {
return 0
Expand Down
10 changes: 6 additions & 4 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,10 @@ func (woc *wfOperationCtx) operate(ctx context.Context) {
if err != nil {
woc.markNodeError(node.Name, err)
}
// Reconcile TaskSet and Agent for HTTP templates
woc.taskSetReconciliation(ctx)
// Reconcile TaskSet and Agent for HTTP templates when is not shutdown
if !woc.execWf.Spec.Shutdown.Enabled() {
woc.taskSetReconciliation(ctx)
}

// Check all hooks are completes
if !hookCompleted {
Expand Down Expand Up @@ -1222,8 +1224,8 @@ func (woc *wfOperationCtx) shouldPrintPodSpec(node *wfv1.NodeStatus) bool {

func (woc *wfOperationCtx) failSuspendedAndPendingNodesAfterDeadlineOrShutdown() {
for _, node := range woc.wf.Status.Nodes {
// fail suspended nodes when shuting down
if woc.GetShutdownStrategy().Enabled() && node.IsActiveSuspendNode() {
// fail suspended nodes or plugin nodes when shuting down
if woc.GetShutdownStrategy().Enabled() && (node.IsActiveSuspendNode() || node.IsActivePluginNode()) {
message := fmt.Sprintf("Stopped with strategy '%s'", woc.GetShutdownStrategy())
woc.markNodePhase(node.Name, wfv1.NodeFailed, message)
continue
Expand Down

0 comments on commit c71e1dc

Please sign in to comment.