You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

采用Node First策略时,如何在节点失败后从首步骤重新执行

问题原因与解决方案

原因分析

你遇到的问题源于对Rundeck中keepgoing参数和Node First策略执行逻辑的理解偏差,再加上作业配置的细节疏漏:

  • dispatch.keepgoing: true确实能让节点失败后继续执行下一个节点,但sequence.keepgoing: false仅负责单个节点内步骤失败后停止该节点的后续步骤。
  • 后续节点从上一节点失败步骤开始执行的核心原因是部分步骤未标记为节点步骤,导致执行上下文没有按Node First策略在节点间重置,全局步骤的执行逻辑干扰了节点步骤的顺序。

解决方案

要实现每个节点从头执行完整步骤序列,即使前一个节点失败,需按以下调整:

1. 确保所有步骤都是节点步骤

  • 脚本步骤默认是节点步骤,但要保证语法正确(你作业里第3、4个脚本步骤的script:后缺少|,会导致解析错误,必须补上)。
  • 作业引用(jobref)必须添加nodeStep: 'true',否则会变成全局步骤仅执行一次——你当前最后一个jobref就缺这个配置,这是关键问题之一。

2. 保留正确的策略与keepgoing配置

  • 维持sequence.strategy: node-first,保证按节点优先的顺序执行。
  • 维持sequence.keepgoing: false,单个节点内步骤失败时立即停止该节点的后续操作,避免无效执行。
  • 维持dispatch.keepgoing: true,确保节点失败后自动切换到下一个节点继续。

修正后的完整作业配置

- defaultTab: nodes
  executionEnabled: true
  group: group
  id: <id>
  multipleExecutions: true
  name: <job-name>
  nodeFilterEditable: true
  nodefilters:
    dispatch:
      excludePrecedence: true
      keepgoing: true
      rankOrder: ascending
      successOnEmptyNodeFilter: false
      threadcount: '1'
    filter: .*-filter.com
  nodesSelectedByDefault: false
  scheduleEnabled: false
  sequence:
    commands:
    - description: first script
      script: |
        #!/bin/bash
        echo 'first script'
    - jobref:
        args: <some-args>
        group: group
        ignoreNotifications: true
        name: do something
        nodeStep: 'true'
        project: project
        uuid: <job-id>
    - description: Another script
      script: |
        #!/bin/bash
        echo 'another script'
    - description: Yet another script
      script: |
        #!/bin/bash
        echo 'Yet another script'
    - jobref:
        args: <args>
        group: group
        name: Job
        nodeStep: 'true'  # 新增该配置,标记为节点步骤
        uuid: <job-id>
    keepgoing: false
    strategy: node-first
  uuid: <id>

验证效果

调整后,Node First策略会严格按以下逻辑执行:

  1. 逐个处理节点,每个节点都从第一个步骤开始完整执行。
  2. 若某节点在某步骤失败,该节点立即停止后续步骤,自动切换到下一个节点从头执行所有步骤。

内容的提问来源于stack exchange,提问作者Sean E.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 19:55:43