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] Pipelien runs fail due to wrong input parameters type casting #9442

Closed
erhwenkuo opened this issue May 17, 2023 · 0 comments · Fixed by #9481
Closed

[bug] Pipelien runs fail due to wrong input parameters type casting #9442

erhwenkuo opened this issue May 17, 2023 · 0 comments · Fixed by #9481
Assignees
Labels
Milestone

Comments

@erhwenkuo
Copy link

Environment

  • How did you deploy Kubeflow Pipelines (KFP)?

    Use https://github.com/kubeflow/manifests to deploy kubeflow.

    git clone https://github.com/kubeflow/manifests.git
    cd manifests
    git checkout v1.7-branch

    Modify manifests/apps/pipeline/upstream/base/pipeline/kustomization.yaml:

    ...
    images:
      - name: gcr.io/ml-pipeline/api-server
        newTag: 2.0.0-rc.1
      - name: gcr.io/ml-pipeline/persistenceagent
        newTag: 2.0.0-rc.1
      - name: gcr.io/ml-pipeline/scheduledworkflow
        newTag: 2.0.0-rc.1
      - name: gcr.io/ml-pipeline/frontend
        newTag: 2.0.0-rc.1
      - name: gcr.io/ml-pipeline/viewer-crd-controller
        newTag: 2.0.0-rc.1
      - name: gcr.io/ml-pipeline/visualization-server
        newTag: 2.0.0-rc.1
    

    Then, use one command to apply these manifest:

    while ! kustomize build example | awk '!/well-defined/' | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 10; done
  • KFP version:

    version: 2.0.0-rc.1

Steps to reproduce

  1. Create sample pipeline (v2)

    from kfp import dsl
    
    @dsl.component
    def square(x: float) -> float:
        return x ** 2
    
    @dsl.component
    def add(x: float, y: float) -> float:
        return x + y
    
    @dsl.component
    def square_root(x: float) -> float:
        return x ** .5
    
    @dsl.pipeline
    def pythagorean(a: float, b: float) -> float:
        a_sq_task = square(x=a)
        b_sq_task = square(x=b)
        sum_task = add(x=a_sq_task.output, y=b_sq_task.output)
        return square_root(x=sum_task.output).output
    
    compiler.Compiler().compile(pythagorean, 'pipeline.yaml')
  2. Click "Pipelines" menu, then click "Upload pipeline"

    image

  3. Click "Create experiment" button and input experiment name

    image

  4. Configure "Start a run" with pipeline input parameters and click "Start"

    image

    Use browser developer tools and find out UI call "/pipeline/apis/v2beta1/runs" and submit below JSON payload:

    {
      "description": "",
      "display_name": "Run of pythagorean (3d5ba)",
      "experiment_id": "e86993e5-7338-49f0-a129-3f1aa1676a06",
      "pipeline_version_reference": {
        "pipeline_id": "165d1ce7-ed91-4def-ac7a-14aabbdb0704",
        "pipeline_version_id": "77477a12-0a2e-4f1b-860c-2089216ea83f"
      },
      "runtime_config": {
        "parameters": {
          "a": 3,
          "b": 4
        }
      },
      "service_account": ""
    }
  5. After run is triggered and execution fail.

    image

    Checking the logs the error is "VaueError: Function square returned value of type; want type ...

    image

Expected result

UI should detect input parameters type and convert into right JSON number representation.

Pipeline API server should do the right type casting base on IR Yaml.

Reference

The execution log of 1st task (square):

time="2023-05-17T05:52:35.570Z" level=info msg="capturing logs" argo=true
time="2023-05-17T05:52:35.602Z" level=info msg="capturing logs" argo=true
I0517 05:52:35.639643      34 launcher_v2.go:84] input ComponentSpec:{
  "inputDefinitions": {
    "parameters": {
      "x": {
        "parameterType": "NUMBER_DOUBLE"
      }
    }
  },
  "outputDefinitions": {
    "parameters": {
      "Output": {
        "parameterType": "NUMBER_DOUBLE"
      }
    }
  },
  "executorLabel": "exec-square-2"
}
I0517 05:52:35.640545      34 cache.go:139] Cannot detect ml-pipeline in the same namespace, default to ml-pipeline.kubeflow:8887 as KFP endpoint.
I0517 05:52:35.640563      34 cache.go:116] Connecting to cache endpoint ml-pipeline.kubeflow:8887
I0517 05:52:35.777714      34 object_store.go:306] Cannot detect minio-service in the same namespace, default to minio-service.kubeflow:9000 as MinIO endpoint.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 
https://pip.pypa.io/warnings/venv
[KFP Executor 2023-05-17 05:53:02,601 INFO]: Looking for component `square` in --component_module_path `/tmp/tmp.NS1HEzRMO2/ephemeral_component.py`
[KFP Executor 2023-05-17 05:53:02,602 INFO]: Loading KFP component "square" from /tmp/tmp.NS1HEzRMO2/ephemeral_component.py (directory "/tmp/tmp.NS1HEzRMO2" and module name "ephemeral_component")
[KFP Executor 2023-05-17 05:53:02,603 INFO]: Got executor_input:
{
    "inputs": {
        "parameterValues": {
            "x": 4
        }
    },
    "outputs": {
        "parameters": {
            "Output": {
                "outputFile": "/tmp/kfp/outputs/Output"
            }
        },
        "outputFile": "/tmp/kfp_outputs/output_metadata.json"
    }
}
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/site-packages/kfp/components/executor_main.py", line 105, in <module>
    executor_main()
  File "/usr/local/lib/python3.7/site-packages/kfp/components/executor_main.py", line 101, in executor_main
    executor.execute()
  File "/usr/local/lib/python3.7/site-packages/kfp/components/executor.py", line 341, in execute
    self._write_executor_output(result)
  File "/usr/local/lib/python3.7/site-packages/kfp/components/executor.py", line 258, in _write_executor_output
    func_output)
  File "/usr/local/lib/python3.7/site-packages/kfp/components/executor.py", line 228, in _handle_single_return_value
    f'Function `{self._func.__name__}` returned value of type {type(return_value)}; want type {origin_type}'
ValueError: Function `square` returned value of type <class 'int'>; want type <class 'float'>
F0517 05:53:02.719437      34 main.go:49] failed to execute component: exit status 1
Error: exit status 1
Error: exit status 1

Impacted by this bug? Give it a 👍.

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

Successfully merging a pull request may close this issue.

3 participants