【问题标题】:Argo Workflow to continue processing during fan-outArgo Workflow 在扇出期间继续处理
【发布时间】:2022-02-03 22:15:39
【问题描述】:

这里的一般问题,想知道是否有人有任何想法或经验试图实现我现在的目标。我不完全确定它是否可能在 argo 工作流系统中......

我想知道无论动态扇出是否完成,是否可以继续工作流。我所说的动态扇出是指 B1/B2/B3 可能会转到 B30。

我想看看 B1 完成后 C1 是否可以启动。 B 阶段正在创建一个小文件,然后在 C 阶段我需要运行它已完成的 api 请求并上传所述文件。但在这种情况下,B2/B3 仍在处理中。

最后,D1 必须等待所有 C1/2/3-C# 完成完成

绘制我想要实现的目标

#           *
#           | 
#          A1 (generates a dynamic list that can change depending on the inputs) 
#           | 
#        /  |  \ 
#       B1  B2  B3 +++ B#
#       |   |    |
#       C1         +++ C#
#       *   *   *
#        \  |  /
#         \ | /
#           D1

我正在查看https://github.com/argoproj/argo-workflows/blob/master/docs/enhanced-depends-logic.md,但如果这是我实现这一目标所需要的,我无法理解。特别是如果扇出步骤是动态的。

在我看来,它将 C 阶段绑定到整个 B 阶段并要求 B 完成

【问题讨论】:

    标签: dynamic directed-acyclic-graphs argo-workflows argo


    【解决方案1】:

    这样的事情应该可以工作:

    apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    spec:
      templates:
        - name: main
          steps:
            - - name: A
                template: A
            - - name: B_C
                template: B_C
                arguments:
                  parameters:
                    - name: item
                      value: "{{item}}"
                withParam: "{{steps.A.outputs.parameters.items}}"
            - - name: D
                template: D
        - name: A
          # container or script spec here
          outputs:
            parameters:
              - name: items
                valueFrom:
                  path: /tmp/items.json
        - name: B_C
          inputs:
            parameters:
              - name: item
          steps:
            - - name: B
                template: B
                arguments:
                  parameters:
                    - name: item
                      value: "{{inputs.parameters.item}}"
            - - name: C
                template: C
                arguments:
                  artifacts:
                    - name: file
                      from: "{{steps.B.outputs.artifacts.file}}"
        - name: B
          inputs:
            parameters:
              - name: item
          # container or script spec here
          outputs:
            artifacts:
              - name: file
                path: /tmp/file
        - name: C
          inputs:
            artifacts:
              - name: file
          # container or script spec here
        - name: D
          # container or script spec here
    

    main 模板中的步骤B_C 并行运行B_C 模板的实例。

    模板B_C 连续运行BC。一旦模板B_C 启动,它会尽快运行,完全不知道B_C 模板的任何并发执行。所以C1 只在B1 上阻止,从不在B2B3 或任何其他B# 上。

    一旦B_C 的所有实例都完成,main 模板最终会调用D 模板。

    【讨论】:

    • 这确实解决了我的问题,谢谢@crenshaw-dev 的帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-13
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    • 1970-01-01
    • 2022-11-12
    相关资源
    最近更新 更多