Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gcloud cli install and increase KubernetesPodOperator ephemeral-storage #107

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions xlml/utils/xpk.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import google.auth.transport.requests
from google.cloud import container_v1
from kubernetes import client as k8s_client
from kubernetes.client import models as k8s_models


@task
Expand Down Expand Up @@ -58,13 +59,15 @@ def run_workload(

cmds = (
"set -x",
f"gcloud config set project {cluster_project}",
f"gcloud config set compute/zone {zone}",
"git clone https://github.com/google/xpk.git /tmp/xpk",
"cd /tmp/xpk",
"apt-get update && apt-get install -y google-cloud-sdk",
"curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg",
'echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list',
raymondzouu marked this conversation as resolved.
Show resolved Hide resolved
"apt-get update && apt-get install -y google-cloud-cli",
"apt-get install -y kubectl",
"apt-get install -y google-cloud-sdk-gke-gcloud-auth-plugin",
"apt-get install -y google-cloud-cli-gke-gcloud-auth-plugin",
f"gcloud config set project {cluster_project}",
f"gcloud config set compute/zone {zone}",
(
"python3 xpk.py workload create"
f" --cluster={cluster_name} --workload={workload_id} --command='{run_cmds}'"
Expand All @@ -78,11 +81,14 @@ def run_workload(
cmds=["/bin/bash", "-c"],
arguments=[";".join(cmds)],
namespace="composer-user-workloads",
image=docker_image,
image="python:3.10",
config_file="/home/airflow/composer_kube_config",
kubernetes_conn_id="kubernetes_default",
startup_timeout_seconds=startup_timeout,
owner=task_owner,
container_resources=k8s_models.V1ResourceRequirements(
limits={"ephemeral-storage": "10G"},
RissyRan marked this conversation as resolved.
Show resolved Hide resolved
),
)


Expand Down
Loading