kubeflow / pipelines

Machine Learning Pipelines for Kubeflow
https://www.kubeflow.org/docs/components/pipelines/
Apache License 2.0
3.62k stars 1.63k forks source link

[bug] <Bug Name>set_env_variable doesn't set env var in a component when running with local.DockerRunner #11341

Open EladProject opened 3 weeks ago

EladProject commented 3 weeks ago

Environment

Steps to reproduce

I try to run the following test:

from kfp import dsl
from kfp import local

local.init(runner=local.DockerRunner())

@dsl.component
def print_and_return_env_var() -> str:
    import os
    val = os.environ.get('ENV1')
    print("ENV1:", val)
    return val

@dsl.pipeline
def env_var_test() -> str:
    res = print_and_return_env_var()
    res = res.set_env_variable(name="ENV1", value="yoyo")
    return res.output

def test_env_var_local():
    res = env_var_test()
    assert res.output == "yoyo"

Expected result

To print "ENV1: yoyo" To return "yoyo" in the pipeline result

Materials and reference

When I compile the pipeline, I do see the env var in the pipeline.yaml

Labels

/area backend


Impacted by this bug? Give it a 👍.