【问题标题】:How to skip a step for Argo workflow如何跳过 Argo 工作流程的步骤
【发布时间】:2019-07-02 02:25:15
【问题描述】:

我正在尝试 Argo 工作流程,并想了解如何冻结步骤。假设我有 3 步工作流,而工作流在第 2 步失败。所以我想使用成功的第 1 步的工件从第 2 步重新提交工作流。我怎样才能做到这一点?我在文档的任何地方都找不到指导。

【问题讨论】:

    标签: kubernetes argoproj argo-workflows


    【解决方案1】:

    我认为您应该考虑在您的步骤中使用ConditionsArtifact passing

    条件提供了一种影响控制流的方法 运行时的工作流,取决于参数。在这个例子中 'print-hello' 模板可能会或可能不会被执行,具体取决于 在输入参数上,“应该打印”。提交时

    $ argo submit examples/conditionals.yaml

    该步骤将被跳过,因为 'should-print' 将评估为 false。 提交时:

    $ argo submit examples/conditionals.yaml -p should-print=true

    该步骤将被执行,因为 'should-print' 将评估为真。

    apiVersion: argoproj.io/v1alpha1
    kind: Workflow
    metadata:
      generateName: conditional-
    spec:
      entrypoint: conditional-example
      arguments:
        parameters:
        - name: should-print
          value: "false"
    
      templates:
      - name: conditional-example
        inputs:
          parameters:
          - name: should-print
        steps:
        - - name: print-hello
            template: whalesay
            when: "{{inputs.parameters.should-print}} == true"
    
      - name: whalesay
        container:
          image: docker/whalesay:latest
          command: [sh, -c]
          args: ["cowsay hello"]
    

    如果您在每个步骤中使用条件,您将能够从您喜欢的具有适当条件的步骤开始。

    在这篇文章Argo: Workflow Engine for Kubernetes 上也有一个战利品,因为作者在coinflip example 上解释了条件的使用。 你可以在他们的GitHub page看到很多例子。

    【讨论】:

    • 感谢您的评论 :) 我知道条件,但是否可以使用从不同运行创建的工件(例如来自以前失败的工件)?
    • 您的意思是在新工作流中使用失败的工作流工件?
    • 它想采用失败的工作流程并使用不同的图像从失败的特定步骤重新开始。这样我就不必一遍又一遍地运行以前成功的步骤。
    • 我不知道,但我认为这不可能。工作流失败,应该无法在新工作流中使用该工作流中的工件,尤其是在图像更改时。
    猜你喜欢
    • 1970-01-01
    • 2020-03-03
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多