Skip to content

Commit

Permalink
Fix invalid pointer when tfjob is deleted (#1285)
Browse files Browse the repository at this point in the history
* Fix invalid pointer when tfjob is deleted

* Removing unnecessary imports

* Removing unnecessary imports
  • Loading branch information
johnugeorge authored Jul 5, 2021
1 parent 0c41b27 commit eb362bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/controller.v1/tensorflow/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ func (tc *TFController) processNextWorkItem() bool {
if err != nil {
if err == errNotExists {
logger.Infof("TFJob has been deleted: %v", key)
tfJobsDeletedCount.WithLabelValues(tfJob.Namespace).Inc()
namespace, _, keyerr := cache.SplitMetaNamespaceKey(key)
if keyerr == nil && len(namespace) != 0 {
tfJobsDeletedCount.WithLabelValues(namespace).Inc()
} else {
logger.Errorf("Invalid TFJob key %s: Namespace is missing %v", key, keyerr)
}
return true
}

Expand Down
1 change: 0 additions & 1 deletion py/kubeflow/tf_operator/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from importlib import import_module

import retrying
from google.cloud import storage # pylint: disable=no-name-in-module
from kubeflow.testing import test_util, util
from kubeflow.tf_operator import util as tf_operator_util

Expand Down
2 changes: 1 addition & 1 deletion py/kubeflow/tf_operator/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import google.auth.transport.requests
import requests
import yaml
from googleapiclient import errors
#from googleapiclient import errors
from kubeflow.testing import util
from kubernetes import client as k8s_client
from kubernetes.client import configuration as kubernetes_configuration
Expand Down

0 comments on commit eb362bd

Please sign in to comment.