Search code examples
machine-learningworkflowargoprojargo-workflows

How do I pass output of one node as an input parameter to another node in Argo workflow DAG


I am trying to construct a ML pipeline DAG using Argo. And I am running into an issue where I need a value from one node in the DAG to be sent as a parameter to its subsequent node. Say the ARGO DAG structure looks like the following:

{
  "apiVersion": "argoproj.io/v1alpha1",
  "kind": "Workflow",
  "metadata": {
    "generateName": "workflow01-"
  },
  "spec": {
    "entrypoint": "workflow01",
    "arguments": {
      "parameters": [
        {
          "name": "log-level",
          "value": "INFO"
        }
      ]
    },
    "templates": [
      {
        "name": "workflow01",
        "dag": {
          "tasks": [
            {
              "name": "A",
              "template": "task-container",
              "arguments": {
                "parameters": [
                  {
                    "name": "model-type",
                    "value": "INTENT-TRAIN"
                  }
                ]
              }
            },
            {
              "name": "B",
              "template": "task-container",
              "dependencies": ["A"],
              "arguments": {
                "parameters": [
                  {
                    "name": "model-type",
                    "value": "INTENT-EVALUATE"
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "name": "task-container",
        "inputs": {
          "parameters": [
            {
              "name": "model-type",
              "value": "NIL"
            }
          ]
        },
        "container": {
          "env": [
            {
              "name": "LOG_LEVEL",
              "value": "{{workflow.parameters.log-level}}"
            },
            {
              "name": "MODEL_TYPE",
              "value": "{{inputs.parameters.model-type}}"
            }
          ]
        }
      }
    ]
  }
}

A -> B

The computation happening in B depends on the value that has been computed in A.

How will I be able to pass the value computed in A into B?


Solution

  • You can use Argo's "artifacts" for this - see the examples at https://github.com/argoproj/argo-workflows/tree/master/examples#artifacts

    Another way is to set up a shared volume: https://github.com/argoproj/argo-workflows/tree/master/examples#volumes