kestra icon indicating copy to clipboard operation
kestra copied to clipboard

API didn't return flow's output if there's a subflow in the flow

Open razuro opened this issue 4 months ago • 3 comments

Describe the issue

Hi Team,

I'm using the API http://localhost:8080/api/v1/executions/company.team/secondary_flow?wait=true Inside this flow, there's a subflow.

Expected API output: API will return the flow's output (named: secondary_flow)

Actual output: API return the subflow's output

Subflow

id: main_flow
namespace: company.team
tasks:
  - id: primary
    type: io.kestra.plugin.core.debug.Return
    format: Hello

outputs:
  - id: main_output
    type: JSON
    value: |
      {
        "main_output": {{ outputs.primary }}
      }

The flow that called the main flow

id: secondary_flow
namespace: company.team
tasks:
  - id: call_main_flow
    type: io.kestra.plugin.core.flow.Subflow
    namespace: company.team
    flowId: main_flow
    wait: true

outputs:
  - id: secondary_output
    type: JSON
    value: |
      {
        "secondary_output": {{ outputs.call_main_flow }}
      }

API Result

{
    "id": "4JiKMvDGS70R2z4iVPTeiD",
    "namespace": "company.team",
    "flowId": "secondary_flow",
    "flowRevision": 2,
    "taskRunList": [
        {
            "id": "4qLteeEAKFop9nQ2KoS5H",
            "executionId": "4JiKMvDGS70R2z4iVPTeiD",
            "namespace": "company.team",
            "flowId": "secondary_flow",
            "taskId": "call_main_flow",
            "attempts": [
                {
                    "state": {
                        "current": "SUCCESS",
                        "histories": [
                            {
                                "state": "CREATED",
                                "date": "2024-10-06T11:17:05.341Z"
                            },
                            {
                                "state": "RUNNING",
                                "date": "2024-10-06T11:17:05.378Z"
                            },
                            {
                                "state": "SUCCESS",
                                "date": "2024-10-06T11:17:05.534Z"
                            }
                        ],
                        "duration": "PT0.193S",
                        "startDate": "2024-10-06T11:17:05.341Z",
                        "endDate": "2024-10-06T11:17:05.534Z"
                    }
                }
            ],
            "outputs": {
                "state": "SUCCESS",
                "outputs": {
                    "main_output": {
                        "main_output": {
                            "value": "Hello"
                        }
                    }
                },
                "executionId": "1ctHxlLheKUikZFHfmQPWL"
            },
            "state": {
                "current": "SUCCESS",
                "histories": [
                    {
                        "state": "CREATED",
                        "date": "2024-10-06T11:17:05.341Z"
                    },
                    {
                        "state": "RUNNING",
                        "date": "2024-10-06T11:17:05.378Z"
                    },
                    {
                        "state": "SUCCESS",
                        "date": "2024-10-06T11:17:05.534Z"
                    }
                ],
                "duration": "PT0.193S",
                "startDate": "2024-10-06T11:17:05.341Z",
                "endDate": "2024-10-06T11:17:05.534Z"
            }
        }
    ],
    "outputs": {
        "call_main_flow": {
            "state": "SUCCESS",
            "outputs": {
                "main_output": {
                    "main_output": {
                        "value": "Hello"
                    }
                }
            },
            "executionId": "1ctHxlLheKUikZFHfmQPWL"
        }
    },
    "state": {
        "current": "SUCCESS",
        "histories": [
            {
                "state": "CREATED",
                "date": "2024-10-06T11:17:05.308Z"
            },
            {
                "state": "RUNNING",
                "date": "2024-10-06T11:17:05.341Z"
            },
            {
                "state": "SUCCESS",
                "date": "2024-10-06T11:17:05.572Z"
            }
        ],
        "duration": "PT0.264S",
        "startDate": "2024-10-06T11:17:05.308Z",
        "endDate": "2024-10-06T11:17:05.572Z"
    },
    "originalId": "4JiKMvDGS70R2z4iVPTeiD",
    "deleted": false,
    "metadata": {
        "attemptNumber": 1,
        "originalCreatedDate": "2024-10-06T11:17:05.308Z"
    },
    "url": "http://localhost:8080//ui/executions/company.team/secondary_flow/4JiKMvDGS70R2z4iVPTeiD"
}

Environment

  • Kestra Version: v0.19.0
  • Operating System (OS/Docker/Kubernetes): Docker
  • Java Version (if you don't run kestra in Docker): -

razuro avatar Oct 06 '24 11:10 razuro