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

SDK: fix label check for ContainerOP entities #2243

Merged
merged 1 commit into from
Sep 26, 2019
Merged

SDK: fix label check for ContainerOP entities #2243

merged 1 commit into from
Sep 26, 2019

Conversation

solovyevt
Copy link
Contributor

@solovyevt solovyevt commented Sep 26, 2019

Fix ContainerOp label check during compilation step. Previously it was failing with KeyError: 'add-pod-env' if you added custom labels to ContainerOp object with ContainerOp.add_pod_label() function.


This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @solovyevt. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@Ark-kun
Copy link
Contributor

Ark-kun commented Sep 26, 2019

Good catch.
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ark-kun

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -17,7 +17,7 @@
def add_pod_env(op: BaseOp) -> BaseOp:
"""Adds pod environment info to ContainerOp.
"""
if isinstance(op, ContainerOp) and op.pod_labels and op.pod_labels['add-pod-env'] == 'true':
if isinstance(op, ContainerOp) and op.pod_labels and 'add-pod-env' in op.pod_labels and op.pod_labels['add-pod-env'] == 'true':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be just op.get('pod_labels', None) and op.pod_labels.get('add-pod-env'], None == 'true')

@k8s-ci-robot k8s-ci-robot merged commit 389b585 into kubeflow:master Sep 26, 2019
@Ark-kun
Copy link
Contributor

Ark-kun commented Sep 26, 2019

BTW, what's your use case for labels?

@solovyevt
Copy link
Contributor Author

solovyevt commented Sep 27, 2019

@Ark-kun
Got a special use-case with PodAntiAffinity:

container_op.add_pod_label(
        name="io.avoidme",
        value="true"
    )
container_op.add_affinity(affinity=k8s_client.V1Affinity(
        pod_anti_affinity=k8s_client.V1PodAntiAffinity(
            required_during_scheduling_ignored_during_execution=[
                k8s_client.V1PodAffinityTerm(
                    topology_key="kubernetes.io/hostname",
                    label_selector=k8s_client.V1LabelSelector(
                        match_expressions=[
                            k8s_client.V1LabelSelectorRequirement(
                                key="io.avoidme",
                                operator="In",
                                values=["true"]
                            )
                        ]
                    )
                )
            ]
        )
))

magdalenakuhn17 pushed a commit to magdalenakuhn17/pipelines that referenced this pull request Oct 22, 2023
* Add router image publish github action

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Fix model status test

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Update isvc crd for autoscaling fields

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Fix helm chart webhook configuration

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Update modelmesh serving runtime crd

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Use yaml variable for version

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Add inferencegraphs rbac

Signed-off-by: Dan Sun <dsun20@bloomberg.net>

* Fix watcher test

Signed-off-by: Dan Sun <dsun20@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants