Skip to content

Commit

Permalink
mwa(back): Fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Elena Zioga <elena@arrikto.com>
  • Loading branch information
elenzio9 committed Mar 22, 2023
1 parent fa3b256 commit 93a4156
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions backend/apps/common/routes/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ def get_inference_service_logs(svc):
log.info(components)

# dictionary{component: [pod-names]}
if svc["metadata"]["annotations"].get("serving.kubeflow.org/raw", "false") == "true":
component_pods_dict = utils.get_raw_inference_service_pods(svc, components)
if svc["metadata"]["annotations"].get(
"serving.kubeflow.org/raw", "false") == "true":
component_pods_dict = utils.get_raw_inference_service_pods(
svc, components)
else:
component_pods_dict = utils.get_inference_service_pods(svc, components)

Expand Down
13 changes: 10 additions & 3 deletions backend/apps/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,21 @@ def load_inference_service_template(**kwargs):
"""
return helpers.load_param_yaml(INFERENCESERVICE_TEMPLATE_YAML, **kwargs)

# helper functions for accessing the logs of an InferenceService in raw kubernetes mode
# helper functions for accessing the logs of an InferenceService in raw
# kubernetes mode


def get_raw_inference_service_pods(svc, components=[]):
"""
Return a dictionary with (endpoint, component) keys
i.e. ("default", "predictor") and a list of pod names as values
"""
namespace = svc["metadata"]["namespace"]
svc_name = svc["metadata"]["name"]
label_selector = "serving.kubeflow.org/inferenceservice={}".format(svc_name)
pods = api.v1_core.list_namespaced_pod(namespace, label_selector=label_selector).items
label_selector = "serving.kubeflow.org/inferenceservice={}".format(
svc_name)
pods = api.v1_core.list_namespaced_pod(
namespace, label_selector=label_selector).items
component_pods_dict = {}
for pod in pods:
component = pod.metadata.labels.get("component", "")
Expand All @@ -50,6 +55,8 @@ def get_raw_inference_service_pods(svc, components=[]):
return component_pods_dict

# helper functions for accessing the logs of an InferenceService


def get_inference_service_pods(svc, components=[]):
"""
Return the Pod names for the different isvc components.
Expand Down

0 comments on commit 93a4156

Please sign in to comment.