Repository: kubeflow/pipelines

Issue:
[sdk] v2compat - consistent naming of pipeline root parameter
pipeline root parameter is called `pipeline-output-directory` in KFP UI/SDK
can we rename it to `pipeline-root` to be consistent with SDK API?

_Originally posted by @Bobgy in https://github.com/kubeflow/pipelines/issues/5779#issuecomment-897227634_


Discussion:
/assign @chensun 
I agree with the consistency on naming it `pipeline-root`. Also TFX is using the term `pipeline-root`: https://www.tensorflow.org/tfx/guide/build_tfx_pipeline#using_the_pipeline_class. 

Resolving patch:
diff --git a/sdk/python/kfp/dsl/__init__.py b/sdk/python/kfp/dsl/__init__.py
--- a/sdk/python/kfp/dsl/__init__.py
+++ b/sdk/python/kfp/dsl/__init__.py
@@ -26,4 +26,4 @@
 EXECUTION_ID_PLACEHOLDER = '{{workflow.uid}}-{{pod.name}}'
 RUN_ID_PLACEHOLDER = '{{workflow.uid}}'
 
-ROOT_PARAMETER_NAME = 'pipeline-output-directory'
+ROOT_PARAMETER_NAME = 'pipeline-root'
diff --git a/sdk/python/kfp/dsl/_component_bridge.py b/sdk/python/kfp/dsl/_component_bridge.py
--- a/sdk/python/kfp/dsl/_component_bridge.py
+++ b/sdk/python/kfp/dsl/_component_bridge.py
@@ -39,7 +39,7 @@
 # ensure being extracted as a pipeline parameter during compilation.
 # Note that we cannot direclty import dsl module here due to circular
 # dependencies.
-OUTPUT_DIR_PLACEHOLDER = '{{pipelineparam:op=;name=pipeline-output-directory}}'
+OUTPUT_DIR_PLACEHOLDER = '{{pipelineparam:op=;name=pipeline-root}}'
 # Placeholder to represent to UID of the current pipeline at runtime.
 # Will be replaced by engine-specific placeholder during compilation.
 RUN_ID_PLACEHOLDER = '{{kfp.run_uid}}'


Test patch:
diff --git a/backend/src/apiserver/resource/resource_manager_test.go b/backend/src/apiserver/resource/resource_manager_test.go
--- a/backend/src/apiserver/resource/resource_manager_test.go
+++ b/backend/src/apiserver/resource/resource_manager_test.go
@@ -2172,7 +2172,7 @@ metadata:
   annotations:
     pipelines.kubeflow.org/kfp_sdk_version: 1.6.4
     pipelines.kubeflow.org/pipeline_compilation_time: '2021-07-14T06:59:20.208189'
-    pipelines.kubeflow.org/pipeline_spec: '{"inputs": [{"default": "", "name": "pipeline-output-directory"},
+    pipelines.kubeflow.org/pipeline_spec: '{"inputs": [{"default": "", "name": "pipeline-root"},
       {"default": "pipeline/two_step_pipeline", "name": "pipeline-name"}], "name":
       "two_step_pipeline"}'
     pipelines.kubeflow.org/v2_pipeline: "true"
@@ -2228,7 +2228,7 @@ spec:
         --mlmd_server_port, $(METADATA_GRPC_SERVICE_PORT), --runtime_info_json, $(KFP_V2_RUNTIME_INFO),
         --container_image, $(KFP_V2_IMAGE), --task_name, preprocess, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --pipeline_run_id, $(WORKFLOW_ID),
-        --pipeline_task_id, $(KFP_POD_NAME), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        --pipeline_task_id, $(KFP_POD_NAME), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --, some_int=12, uri=uri-to-import, --]
       env:
       - name: KFP_POD_NAME
@@ -2257,7 +2257,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
     outputs:
       parameters:
       - name: preprocess-output_parameter_one
@@ -2330,7 +2330,7 @@ spec:
         --mlmd_server_port, $(METADATA_GRPC_SERVICE_PORT), --runtime_info_json, $(KFP_V2_RUNTIME_INFO),
         --container_image, $(KFP_V2_IMAGE), --task_name, train-op, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --pipeline_run_id, $(WORKFLOW_ID),
-        --pipeline_task_id, $(KFP_POD_NAME), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        --pipeline_task_id, $(KFP_POD_NAME), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --, 'num_steps={{inputs.parameters.preprocess-output_parameter_one}}', --]
       env:
       - name: KFP_POD_NAME
@@ -2359,7 +2359,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       - {name: preprocess-output_parameter_one}
       artifacts:
       - {name: preprocess-output_dataset_one, path: /tmp/inputs/dataset/data}
@@ -2387,7 +2387,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
     dag:
       tasks:
       - name: preprocess
@@ -2395,20 +2395,20 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
       - name: train-op
         template: train-op
         dependencies: [preprocess]
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           - {name: preprocess-output_parameter_one, value: '{{tasks.preprocess.outputs.parameters.preprocess-output_parameter_one}}'}
           artifacts:
           - {name: preprocess-output_dataset_one, from: '{{tasks.preprocess.outputs.artifacts.preprocess-output_dataset_one}}'}
   arguments:
     parameters:
-    - {name: pipeline-output-directory, value: ''}
+    - {name: pipeline-root, value: ''}
     - {name: pipeline-name, value: pipeline/two_step_pipeline}
   serviceAccountName: pipeline-runner
 `
diff --git a/samples/test/simple_pipeline_without_importer_test.py b/samples/test/simple_pipeline_without_importer_test.py
--- a/samples/test/simple_pipeline_without_importer_test.py
+++ b/samples/test/simple_pipeline_without_importer_test.py
@@ -26,7 +26,7 @@ def verify(run, run_id: str, **kwargs):
     # Both cases fail with:
     # RuntimeError: Internal compiler error: Compiler has produced Argo-incompatible workflow.
     # Please create a new issue at https://github.com/kubeflow/pipelines/issues attaching the pipeline code and the pipeline package.
-    # Error: time="2021-04-06T16:57:32.165Z" level=error msg="Error in file /dev/stdin: templates.simple-two-step-pipeline inputs.parameters.pipeline-output-directory was not supplied"
+    # Error: time="2021-04-06T16:57:32.165Z" level=error msg="Error in file /dev/stdin: templates.simple-two-step-pipeline inputs.parameters.pipeline-root was not supplied"
     # time="2021-04-06T16:57:32.165Z" level=fatal msg="Errors encountered in validation"
     # TestCase(
     #     pipeline_func=my_pipeline,
diff --git a/sdk/python/tests/compiler/testdata/uri_artifacts.yaml b/sdk/python/tests/compiler/testdata/uri_artifacts.yaml
--- a/sdk/python/tests/compiler/testdata/uri_artifacts.yaml
+++ b/sdk/python/tests/compiler/testdata/uri_artifacts.yaml
@@ -7,7 +7,7 @@ metadata:
     pipelines.kubeflow.org/pipeline_compilation_time: '2021-08-07T00:27:52.329848'
     pipelines.kubeflow.org/pipeline_spec: '{"inputs": [{"default": "Hello world!",
       "name": "text", "optional": true, "type": "String"}, {"default": "gs://my-bucket/my-output-dir",
-      "name": "pipeline-output-directory"}, {"default": "pipeline/uri-artifact-pipeline",
+      "name": "pipeline-root"}, {"default": "pipeline/uri-artifact-pipeline",
       "name": "pipeline-name"}], "name": "uri-artifact-pipeline"}'
     pipelines.kubeflow.org/v2_pipeline: "true"
   labels:
@@ -20,7 +20,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       artifacts:
       - {name: write-to-gcs-output_gcs_path}
     dag:
@@ -30,7 +30,7 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           artifacts:
           - {name: write-to-gcs-output_gcs_path, from: '{{inputs.artifacts.write-to-gcs-output_gcs_path}}'}
   - name: flip-coin
@@ -43,7 +43,7 @@ spec:
         --container_image, $(KFP_V2_IMAGE), --task_name, flip-coin, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --run_id, $(KFP_RUN_ID), --run_resource,
         workflows.argoproj.io/$(WORKFLOW_ID), --namespace, $(KFP_NAMESPACE), --pod_name,
-        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --enable_caching, $(ENABLE_CACHING), --, --]
       env:
       - name: KFP_POD_NAME
@@ -76,7 +76,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
     outputs:
       parameters:
       - name: flip-coin-output
@@ -103,7 +103,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       artifacts:
       - {name: write-to-gcs-output_gcs_path}
     dag:
@@ -113,7 +113,7 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           artifacts:
           - {name: write-to-gcs-output_gcs_path, from: '{{inputs.artifacts.write-to-gcs-output_gcs_path}}'}
   - name: read-from-gcs
@@ -130,7 +130,7 @@ spec:
         --container_image, $(KFP_V2_IMAGE), --task_name, read-from-gcs, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --run_id, $(KFP_RUN_ID), --run_resource,
         workflows.argoproj.io/$(WORKFLOW_ID), --namespace, $(KFP_NAMESPACE), --pod_name,
-        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --enable_caching, $(ENABLE_CACHING), --, --]
       env:
       - name: KFP_POD_NAME
@@ -164,7 +164,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       artifacts:
       - {name: write-to-gcs-output_gcs_path, path: /tmp/inputs/input_gcs_path/data}
     metadata:
@@ -197,7 +197,7 @@ spec:
         --container_image, $(KFP_V2_IMAGE), --task_name, read-from-gcs-2, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --run_id, $(KFP_RUN_ID), --run_resource,
         workflows.argoproj.io/$(WORKFLOW_ID), --namespace, $(KFP_NAMESPACE), --pod_name,
-        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --enable_caching, $(ENABLE_CACHING), --, --]
       env:
       - name: KFP_POD_NAME
@@ -231,7 +231,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       artifacts:
       - {name: write-to-gcs-output_gcs_path, path: /tmp/inputs/input_gcs_path/data}
     metadata:
@@ -264,7 +264,7 @@ spec:
         --container_image, $(KFP_V2_IMAGE), --task_name, read-from-gcs-3, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --run_id, $(KFP_RUN_ID), --run_resource,
         workflows.argoproj.io/$(WORKFLOW_ID), --namespace, $(KFP_NAMESPACE), --pod_name,
-        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --enable_caching, $(ENABLE_CACHING), --, --]
       env:
       - name: KFP_POD_NAME
@@ -298,7 +298,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       artifacts:
       - {name: write-to-gcs-output_gcs_path, path: /tmp/inputs/input_gcs_path/data}
     metadata:
@@ -321,7 +321,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       - {name: text}
     dag:
       tasks:
@@ -332,7 +332,7 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           artifacts:
           - {name: write-to-gcs-output_gcs_path, from: '{{tasks.write-to-gcs.outputs.artifacts.write-to-gcs-output_gcs_path}}'}
       - name: flip-coin
@@ -340,14 +340,14 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
       - name: for-loop-2
         template: for-loop-2
         dependencies: [write-to-gcs]
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           artifacts:
           - {name: write-to-gcs-output_gcs_path, from: '{{tasks.write-to-gcs.outputs.artifacts.write-to-gcs-output_gcs_path}}'}
         withItems: [1, 2, 3, 4]
@@ -357,7 +357,7 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           artifacts:
           - {name: write-to-gcs-output_gcs_path, from: '{{tasks.write-to-gcs.outputs.artifacts.write-to-gcs-output_gcs_path}}'}
       - name: write-to-gcs
@@ -365,7 +365,7 @@ spec:
         arguments:
           parameters:
           - {name: pipeline-name, value: '{{inputs.parameters.pipeline-name}}'}
-          - {name: pipeline-output-directory, value: '{{inputs.parameters.pipeline-output-directory}}'}
+          - {name: pipeline-root, value: '{{inputs.parameters.pipeline-root}}'}
           - {name: text, value: '{{inputs.parameters.text}}'}
   - name: write-to-gcs
     container:
@@ -382,7 +382,7 @@ spec:
         --container_image, $(KFP_V2_IMAGE), --task_name, write-to-gcs, --pipeline_name,
         '{{inputs.parameters.pipeline-name}}', --run_id, $(KFP_RUN_ID), --run_resource,
         workflows.argoproj.io/$(WORKFLOW_ID), --namespace, $(KFP_NAMESPACE), --pod_name,
-        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-output-directory}}',
+        $(KFP_POD_NAME), --pod_uid, $(KFP_POD_UID), --pipeline_root, '{{inputs.parameters.pipeline-root}}',
         --enable_caching, $(ENABLE_CACHING), --, 'text={{inputs.parameters.text}}',
         --]
       env:
@@ -417,7 +417,7 @@ spec:
     inputs:
       parameters:
       - {name: pipeline-name}
-      - {name: pipeline-output-directory}
+      - {name: pipeline-root}
       - {name: text}
     outputs:
       artifacts:
@@ -442,6 +442,6 @@ spec:
   arguments:
     parameters:
     - {name: text, value: Hello world!}
-    - {name: pipeline-output-directory, value: 'gs://my-bucket/my-output-dir'}
+    - {name: pipeline-root, value: 'gs://my-bucket/my-output-dir'}
     - {name: pipeline-name, value: pipeline/uri-artifact-pipeline}
   serviceAccountName: pipeline-runner