Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VladaZakharova committed Feb 14, 2024
1 parent 88ad53e commit cdfa800
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 94 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/google/cloud/hooks/kubernetes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def get_cluster(

def check_cluster_autoscaling_ability(self, cluster: Cluster | dict):
"""
Helper method to check if the specified Cluster has ability to autoscale.
Check if the specified Cluster has ability to autoscale.
Cluster should be Autopilot, with Node Auto-provisioning or regular auto-scaled node pools.
Returns True if the Cluster supports autoscaling, otherwise returns False.
Expand Down
12 changes: 5 additions & 7 deletions airflow/providers/google/cloud/operators/kubernetes_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(
self._ssl_ca_cert = None

def fetch_cluster_info(self) -> tuple[str, str | None]:
"""Fetches cluster info for connecting to it."""
"""Fetch cluster info for connecting to it."""
cluster = self.cluster_hook.get_cluster(
name=self.cluster_name,
project_id=self.project_id,
Expand Down Expand Up @@ -530,7 +530,7 @@ def pod_hook(self) -> GKEPodHook:

@staticmethod
def _get_yaml_content_from_file(kueue_yaml_url) -> list[dict]:
"""Helper method to download content of YAML file and separate it into several dictionaries."""
"""Download content of YAML file and separate it into several dictionaries."""
response = requests.get(kueue_yaml_url, allow_redirects=True)
yaml_dicts = []
if response.status_code == 200:
Expand All @@ -545,13 +545,12 @@ def _get_yaml_content_from_file(kueue_yaml_url) -> list[dict]:
return yaml_dicts

def execute(self, context: Context):
cluster_info = GKEClusterAuthDetails(
project_id=self.project_id,
self._cluster_url, self._ssl_ca_cert = GKEClusterAuthDetails(
cluster_name=self.cluster_name,
project_id=self.project_id,
use_internal_ip=self.use_internal_ip,
cluster_hook=self.cluster_hook,
)
self._cluster_url, self._ssl_ca_cert = cluster_info.fetch_cluster_info()
).fetch_cluster_info()

cluster = self.cluster_hook.get_cluster(
name=self.cluster_name,
Expand Down Expand Up @@ -733,7 +732,6 @@ def hook(self) -> GKEPodHook:
return hook

def execute(self, context: Context):
"""Executes process of creating pod and executing provided command inside it."""
"""Execute process of creating pod and executing provided command inside it."""
self.fetch_cluster_info()
return super().execute(context)
Expand Down
Loading

0 comments on commit cdfa800

Please sign in to comment.