Max*_*ler 4 google-cloud-platform google-cloud-composer
至于文档,Google Cloud Composer气流工作者节点由专用的kubernetes集群提供:
我有一个Docker包含ETL步骤,我想使用气流运行,最好是在专用群集上托管Workers OR的相同Kubernetes.
Docker Operation从Cloud Composer气流环境开始,最佳做法是什么?
务实的解决方案是❤️
Google Cloud Composer刚刚发布到General Availability中,您现在可以使用a KubernetesPodOperator将pod发送到托管气流使用的同一GKE集群中.
确保您的Composer环境至少为1.0.0
一个示例运算符:
import datetime
from airflow import models
from airflow.contrib.operators import kubernetes_pod_operator
with models.DAG(
dag_id='composer_sample_kubernetes_pod',
schedule_interval=datetime.timedelta(days=1),
start_date=YESTERDAY) as dag:
# Only name, namespace, image, and task_id are required to create a
# KubernetesPodOperator. In Cloud Composer, currently the operator defaults
# to using the config file found at `/home/airflow/composer_kube_config if
# no `config_file` parameter is specified. By default it will contain the
# credentials for Cloud Composer's Google Kubernetes Engine cluster that is
# created upon environment creation.
kubernetes_min_pod = kubernetes_pod_operator.KubernetesPodOperator(
# The ID specified for the task.
task_id='pod-ex-minimum',
# Name of task you want to run, used to generate Pod ID.
name='pod-ex-minimum',
# The namespace to run within Kubernetes, default namespace is
# `default`. There is the potential for the resource starvation of
# Airflow workers and scheduler within the Cloud Composer environment,
# the recommended solution is to increase the amount of nodes in order
# to satisfy the computing requirements. Alternatively, launching pods
# into a custom namespace will stop fighting over resources.
namespace='default',
# Docker image specified. Defaults to hub.docker.com, but any fully
# qualified URLs will point to a custom repository. Supports private
# gcr.io images if the Composer Environment is under the same
# project-id as the gcr.io images.
image='gcr.io/gcp-runtimes/ubuntu_16_0_4')
Run Code Online (Sandbox Code Playgroud)
其他资源:
| 归档时间: |
|
| 查看次数: |
1382 次 |
| 最近记录: |