Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure node phases propagate correctly. Fixes #12869 #12991

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

isubasinghe
Copy link
Member

@isubasinghe isubasinghe commented Apr 29, 2024

Fixes #12869
The previous code contained a logic error and always inherited node.Phase, this isn't always desirable, on failure it should inherit the parents phase.

In addition to this, the codebase also updates the outbound nodes for the targetTasks. This fix was contributed by @Joibel even though the commits here do not indicate this.

This fix is an interim fix while I rewrite some of the DAG code, generally speaking the DAG part of the codebase has a more dense population of bugs, enough to the point that I think it warrants a rewrite.

Verification

Tested

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: loop-test-
spec:
  entrypoint: main
  templates:
  - name: main
    dag:
      tasks:
        - name: print-json-entry-print-exitcode
          template: print-json-entry-print-exitcode
          arguments:
            parameters:
            - name: index
              value: '0'
        - name: call-access-aggregate-output
          depends: "print-json-entry-print-exitcode"
          template: access-aggregate-output
          arguments:
            parameters:
            - name: aggregate-results
              value: '{{tasks.print-json-entry-print-exitcode.outputs.parameters.exit-code}}'
  - name: print-json-entry-print-exitcode
    inputs:
      parameters:
        - name: index
    outputs:
      parameters:
        - name: exit-code
          valueFrom:
            parameter: "{{tasks.print-exitcode.outputs.result}}"
    dag:
      tasks:
        - name: print-json-entry
          template: print-json-entry
          arguments:
            parameters:
            - name: index
              value: '{{inputs.parameters.index}}'
        - name: print-exitcode
          depends: "print-json-entry.Failed"
          template: print-exitcode
          arguments:
            parameters:
            - name: exitcode
              value: '{{tasks.print-json-entry.exitCode}}'
  - name: print-json-entry
    inputs:
      parameters:
      - name: index
    container:
      image: alpine:latest
      command: [sh, -c]
      args: ["echo intentional failure; exit {{inputs.parameters.index}}"]
  - name: access-aggregate-output
    inputs:
      parameters:
      - name: aggregate-results
        value: 'no-value'
    script:
      image: alpine:latest
      command: [sh]
      source: |
        echo 'inputs.parameters.aggregate-results: "{{inputs.parameters.aggregate-results}}"'
  - name: print-exitcode
    inputs:
      parameters:
      - name: exitcode
        value: ''
    script:
      image: alpine:latest
      command: [sh]
      source: |
        echo '{{inputs.parameters.exitcode}}'

and it is marked as Error as expected.

Signed-off-by: Isitha Subasinghe <isubasinghe@student.unimelb.edu.au>
Signed-off-by: Isitha Subasinghe <isubasinghe@student.unimelb.edu.au>
Signed-off-by: Isitha Subasinghe <isubasinghe@student.unimelb.edu.au>
@isubasinghe isubasinghe marked this pull request as ready for review May 8, 2024 10:56
@isubasinghe isubasinghe requested a review from Joibel May 8, 2024 12:07
@Joibel
Copy link
Member

Joibel commented May 8, 2024

/retest

1 similar comment
@isubasinghe
Copy link
Member Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workflow hangs, unable to proceed and mark completed when a sub dag failed to resolve the output parameter
2 participants