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

[Bug] Global output parameters validation error with reversed dag.tasks order #4273

Closed
cy-zheng opened this issue Oct 14, 2020 · 5 comments · Fixed by #4369
Closed

[Bug] Global output parameters validation error with reversed dag.tasks order #4273

cy-zheng opened this issue Oct 14, 2020 · 5 comments · Fixed by #4369
Labels
solution/workaround There's a workaround, might not be great, but exists type/bug
Milestone

Comments

@cy-zheng
Copy link
Contributor

cy-zheng commented Oct 14, 2020

Summary

What happened/what you expected to happen?

A workflow using global output parameter and DAG could work well with Argo, but if I reverse the dag.tasks list, argo server would return a global output parameters validation error like:

{
    "code": 2,
    "message": "templates.dag.tasks.second templates.second: failed to resolve {{workflow.outputs.parameters.first-global-name}}"
}

Expection:
Parameter verification should not be related to DAG tasks' order.

Diagnostics

What Kubernetes provider are you using?

Bare-metal v1.13.12

What version of Argo Workflows are you running?

v2.11.3

The workflow works well:

POST {argo-server}/api/v1/workflows/test4
{
    "namespace":"test4",
    "workflow":{
        "metadata":{
            "name":"workflow-works-well",
            "namespace":"test4"
        },
        "spec":{
            "templates":[
                {
                    "name":"dag",
                    "dag":{
                        "tasks":[
                            {
                                "name":"first",
                                "template":"first"
                            },
                            {
                                "name":"second",
                                "template":"second",
                                "dependencies":[
                                    "first"
                                ]
                            }
                        ]
                    }
                },
                {
                    "name":"first",
                    "container":{
                        "name":"test",
                        "image":"ubuntu",
                        "command":[
                            "sh",
                            "-c",
                            "echo first > /tmp/empty-dir/output.txt"
                        ],
                        "volumeMounts":[
                            {
                                "mountPath":"/tmp/empty-dir",
                                "name":"output"
                            }
                        ]
                    },
                    "outputs":{
                        "parameters":[
                            {
                                "name":"first-output",
                                "valueFrom":{
                                    "path":"/tmp/empty-dir/output.txt"
                                },
                                "globalName":"first-global-name"
                            }
                        ]
                    },
                    "volumes":[
                        {
                            "name":"output",
                            "emptyDir":{

                            }
                        }
                    ]
                },
                {
                    "name":"second",
                    "container":{
                        "name":"test",
                        "image":"ubuntu",
                        "command":[
                            "sh",
                            "-c",
                            "echo {{workflow.outputs.parameters.first-global-name}}"
                        ]
                    }
                }
            ],
            "entrypoint":"dag",
            "serviceAccountName":"workflow"
        }
    }
}

The workflow suffers from a validation error:

POST {argo-server}/api/v1/workflows/test4
{
    "namespace":"test4",
    "workflow":{
        "metadata":{
            "name":"workflow-error",
            "namespace":"test4"
        },
        "spec":{
            "templates":[
                {
                    "name":"dag",
                    "dag":{
                        "tasks":[
                            {
                                "name":"second",
                                "template":"second",
                                "dependencies":[
                                    "first"
                                ]
                            },
                            {
                                "name":"first",
                                "template":"first"
                            }
                        ]
                    }
                },
                {
                    "name":"first",
                    "container":{
                        "name":"test",
                        "image":"ubuntu",
                        "command":[
                            "sh",
                            "-c",
                            "echo first > /tmp/empty-dir/output.txt"
                        ],
                        "volumeMounts":[
                            {
                                "mountPath":"/tmp/empty-dir",
                                "name":"output"
                            }
                        ]
                    },
                    "outputs":{
                        "parameters":[
                            {
                                "name":"first-output",
                                "valueFrom":{
                                    "path":"/tmp/empty-dir/output.txt"
                                },
                                "globalName":"first-global-name"
                            }
                        ]
                    },
                    "volumes":[
                        {
                            "name":"output",
                            "emptyDir":{

                            }
                        }
                    ]
                },
                {
                    "name":"second",
                    "container":{
                        "name":"test",
                        "image":"ubuntu",
                        "command":[
                            "sh",
                            "-c",
                            "echo {{workflow.outputs.parameters.first-global-name}}"
                        ]
                    }
                }
            ],
            "entrypoint":"dag",
            "serviceAccountName":"workflow"
        }
    }
}

The only different thing is the order of dag.tasks.

Paste the logs from the argo-server:
kubectl logs argo-server-6d5dd8655d-bh9dj -n argo

time="2020-10-14T12:11:04Z" level=error msg="finished unary call with code Unknown" error="templates.dag.tasks.second templates.second: failed to resolve {{workflow.outputs.parameters.first-global-name}}" grpc.code=Unknown grpc.method=CreateWorkflow grpc.service=workflow.WorkflowService grpc.start_time="2020-10-14T12:11:04Z" grpc.time_ms=0.322 span.kind=server system=grpc

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritise the issues with the most 👍.

@alexec
Copy link
Contributor

alexec commented Oct 14, 2020

By the sounds of this, you can work-around by re-ordering tasks.

@alexec alexec added the solution/workaround There's a workaround, might not be great, but exists label Oct 14, 2020
@cy-zheng
Copy link
Contributor Author

By the sounds of this, you can work-around by re-ordering tasks.

Yes. I've tested that reordering works well in all of my cases, and I need to add some topology sorting logic before submitting a workflow to argo.

By the way, is this behavior an expectation of argo? Will it be fixed in a future version?

Thanks for your quick response! @alexec

@alexec
Copy link
Contributor

alexec commented Oct 15, 2020

Well, it is software, so it has bugs. Would you like to submit a PR to fix?

@cy-zheng
Copy link
Contributor Author

Well, it is software, so it has bugs. Would you like to submit a PR to fix?

I'll do more investigation and try to find causes on argo side.

I would try to fix it if I could.

@alexec
Copy link
Contributor

alexec commented Dec 3, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution/workaround There's a workaround, might not be great, but exists type/bug
Projects
None yet
2 participants