Skip to content

Commit

Permalink
Bugfix yaml parsing for GKEStartKueueInsideClusterOperator
Browse files Browse the repository at this point in the history
  • Loading branch information
moiseenkov committed Apr 26, 2024
1 parent 7683344 commit fb279e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions airflow/providers/google/cloud/operators/kubernetes_engine.py
Expand Up @@ -19,7 +19,6 @@

from __future__ import annotations

import re
import warnings
from functools import cached_property
from typing import TYPE_CHECKING, Any, Sequence
Expand Down Expand Up @@ -566,17 +565,10 @@ def pod_hook(self) -> GKEPodHook:
def _get_yaml_content_from_file(kueue_yaml_url) -> list[dict]:
"""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:
yaml_data = response.text
documents = re.split(r"---\n", yaml_data)

for document in documents:
document_dict = yaml.safe_load(document)
yaml_dicts.append(document_dict)
else:
if response.status_code != 200:
raise AirflowException("Was not able to read the yaml file from given URL")
return yaml_dicts

return list(yaml.safe_load_all(response.text))

def execute(self, context: Context):
self._cluster_url, self._ssl_ca_cert = GKEClusterAuthDetails(
Expand Down
Expand Up @@ -103,7 +103,7 @@
project_id=GCP_PROJECT_ID,
location=GCP_LOCATION,
cluster_name=CLUSTER_NAME,
kueue_version="v0.5.1",
kueue_version="v0.6.2",
)
# [END howto_operator_gke_install_kueue]

Expand Down

0 comments on commit fb279e3

Please sign in to comment.