-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature: sidecar for ContainerOp #879
Feature: sidecar for ContainerOp #879
Conversation
Hi @eterna2. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
Hi @eterna2. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to understand the use case more. The idea here is that in a single step, we can launch multiple sidecar containers - synchronously or asynchronously? Why not kick off instances another pipeline from a step, if the step requires replicated efforts?
Asynchronously. The sidecars are services rather than jobs (i.e. mq brokers, db, rest services, ...) I am running a simulation job that is reliant on a few other services. If I provision these services as parallel steps, I would need to add additional scripts to send a termination signal to these services when the simulation job completes. |
Is it worth adding an example or test to illustrate how a sidecar can be added? |
@cliveseldon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a test example to test the functionality?
sdk/python/kfp/dsl/_container_op.py
Outdated
|
||
|
||
class ContainerOp(ContainerBase): | ||
"""Represents an op implemented by a docker container image.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given docker is being phased out, may make sense to just call these 'container image'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given docker is being phased out, may make sense to just call these 'container image'
Can you please provide some link documenting that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well @Ark-kun - its phased out from IBM`s official Kubernetes service
https://www.ibm.com/blogs/bluemix/2019/01/ibm-cloud-kubernetes-service-supports-containerd/
Other providers are also discussing moving away - btw GCP lauched this in beta in Nov as well
https://cloud.google.com/blog/products/containers-kubernetes/containerd-available-for-beta-testing-in-google-kubernetes-engine
👍 to adding sidecar support. Thank you everyone for working on this! |
256e846
to
1f97e2f
Compare
… well as sidecars with Sidecar class. ContainerOp accepts PipelineParam in any valid k8 properties.
1f97e2f
to
383a4f5
Compare
/lgtm Travis has an outage right now. Since the e2e is passing, I will give the approve label and feel free to merge after travis build is passed. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hongye-sun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hongye-sun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test kubeflow-pipeline-sample-test |
def _validate_cpu_string(self, cpu_string): | ||
"Validate a given string is valid for cpu request or limit." | ||
|
||
if isinstance(cpu_string, _pipeline_param.PipelineParam): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we extract this block of code as a separate internal function because it has been used by many functions here?
return value if isinstance(value, list) else [value] | ||
|
||
|
||
def create_and_append(current_list: Union[List[T], None], item: T) -> List[T]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is internally used in this module, could we rename it such that it starts with an underscore?
self.image_pull_policy = image_pull_policy | ||
return self | ||
|
||
def add_port(self, container_port): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a TODO to support pipelineparam for the other configurations besides CPU, memory ,etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already supported - in the compiler._op_to_template
there is a recursive method to replace PipelineParam
and its serialized form into argo variables.
|
||
if re.match(r'^[0-9]+m$', cpu_string) is not None: | ||
return | ||
# util functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move the general utility functions into a separate module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more container_op related but I think it would be helpful to define a decorator that helps for the future deprecation warnings.
/test kubeflow-pipeline-sample-test |
/test kubeflow-pipeline-sample-test |
/hold cancel |
Thanks a lot for contributing to this PR. It helps to unlock many our use cases (not only just sidecar) for k8s resource orchestrations. |
+1. Thank you @eterna2 |
Restoring the kubeflow#900 change that was overwritten by kubeflow#879
Migrate xgboost-operator repo to new test-infra
Motivation
I am using kubeflow pipelines to run simulation experiments, and because of the complexity of the simulation setup, it requires supporting containers which I might want to parameterize.
Status
Waiting for Review
New or updated Features
This PR adds the following features to
kfp
package'sdsl
andcompiler
modules:PipelineParam
for all valid attributes/properties (both string serialized and object instance) indsl.ContainerOp
dsl.ContainerOp.add_sidecar
) withdsl.Sidecar
classcontainer
property for argo workflow template (viadsl.ContainerOp.container
)(i.e. you can set any valid attributes/properties for a k8s
V1Container
object)Example
TLDR changes
This PR will make the following changes:
Created
Container
andSidecar
classeswhich inherits from
V1Container
Updated
ContainerOp
container_kwargs
andsidecars
_container
(and gettercontainer
) which holds theContainer
instancependingDeprecationWarning
for container properties and methodsinputs
to scan through all qualified attributes inContainerOp
to get allPipelineParam
Updated
PipelineParam
pattern
attr to hold regex pattern extracted from serialized stringPipelineParam
from any objectContainerOp to template
_op_to_template
to its own modulePipelineParam
(and its serialized form) with appropriateinput.parameters.%s
Added appropriate unit test for updates
This change is