Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jed Cunningham <[email protected]>
  • Loading branch information
ephraimbuddy and jedcunningham authored Apr 23, 2021
1 parent 98e9d6f commit ccdad89
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions airflow/executors/kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class ResourceVersion(Borg):
def __init__(
self,
*,
kube_client: Optional[client.CoreV1Api] = None,
namespace: Optional[str] = None,
kube_client: client.CoreV1Api = None,
namespace: str = None,
resource_version: Optional[str] = None,
):
Borg.__init__(self)
Expand All @@ -106,8 +106,7 @@ def get_resource_version(kube_client: client.CoreV1Api, namespace: str):
See https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes
"""
pod_list = kube_client.list_namespaced_pod(namespace)
resource_version = pod_list.metadata.resource_version
return resource_version
return pod_list.metadata.resource_version


class KubernetesJobWatcher(multiprocessing.Process, LoggingMixin):
Expand Down Expand Up @@ -303,10 +302,9 @@ def run_pod_async(self, pod: V1Pod, **kwargs):
return resp

def _make_kube_watcher(self) -> KubernetesJobWatcher:
resource_instance = ResourceVersion(
resource_version = ResourceVersion(
kube_client=self.kube_client, namespace=self.kube_config.kube_namespace
)
resource_version = resource_instance.resource_version # pylint: disable=no-member
).resource_version # pylint: disable=no-member
watcher = KubernetesJobWatcher(
watcher_queue=self.watcher_queue,
namespace=self.kube_config.kube_namespace,
Expand Down

0 comments on commit ccdad89

Please sign in to comment.