kubeflow / pipelines

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

Expose docker entrypoint on kfp local runner #6496

Closed etsyamitra closed 6 months ago

etsyamitra commented 3 years ago

Feature Area

kfp local runner through docker exec environment

What feature would you like to see?

Being able to set docker --entrypoint which running the component.

What is the use case or pain point?

Removing the inconsistencies between running through docker and kfp locally with more powerful features. Creating different images just for having separate entrypoint seems like too much overhead, it would be ideal to pass the entrypoint to the docker itself for each component.

Is there a workaround currently?

Bake it into the image


Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

zijianjoy commented 3 years ago

@chensun Hello Chen, would you like to help looking at this issue? Thank you!

cc @lynnmatrix

NikeNano commented 3 years ago

Do it make sens to add it to the entrypoint if you want to change it for different use cases? Could you drop the entrypoint and instead incoporate it as part of the command @etsyamitra ?

etsyamitra commented 3 years ago

That would be ideal, however it seems like it's not parameterized at the moment. could you please clarify how could we provide the entrypoint as a part of the command?

chensun commented 3 years ago

kfp local runner is contributed by a community contributor, and is supported as an Alpha feature. Feel free to send PRs for feature requests like this.

NikeNano commented 3 years ago

parameterized

TheENTRYPOINT specifies a command that will always be executed when the container starts while the CMD specifies arguments that will be fed to the ENTRYPOINT(if left empty the default entrypoint for docker /bin/sh -c will be used. ) Thus could you skip the ENTRYPOINT in your use cases and rely on the CMD to include the differences in terms of ENTRYPOINT?

An example pipelines would be:

import kfp.components as comp
from kfp import LocalClient, run_pipeline_func_locally

# Create a simple component using only bash commands. The output of this component
# can be passed to a downstream component that accepts an input with the same type.
create_step_write_lines = comp.load_component_from_text("""
name: write_lines
description: Writes text to a file.

inputs:
- {name: text, type: String}

outputs:
- {name: data, type: Data}

implementation:
  container:
    image: busybox
    command:
    - sh
    - -c
    - |
      mkdir -p "$(dirname "$1")"
      echo "$0" > "$1"
    args:
    - {inputValue: text}
    - {outputPath: data}
""")

def pipeline():
    write_lines_step = create_step_write_lines(
        text='one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten')

if __name__ == "__main__":

    out = run_pipeline_func_locally(
        pipeline,
        {},
        execution_mode=LocalClient.ExecutionMode("docker"),
    )
    print(out.get_output_file("write-lines"))

where you could change the command to account for different entrypoints to the container, https://www.kubeflow.org/docs/components/pipelines/reference/component-spec/#implementation. Maybe you could give an example on how you like to use this feature @etsyamitra. I would be happy to work on the implementation when I understand the use case better.

NikeNano commented 3 years ago

Does this solve your problem @etsyamitra otherwise please add an example so I better understand what you like to achieve.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rimolive commented 6 months ago

Closing this issue. No activity for more than a year.

/close

google-oss-prow[bot] commented 6 months ago

@rimolive: Closing this issue.

In response to [this](https://github.com/kubeflow/pipelines/issues/6496#issuecomment-2021376403): >Closing this issue. No activity for more than a year. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.