Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc1f10a

Browse files
authored
Fix kubernetespodoperator resources param (GoogleCloudPlatform#2506)
* call new subpackage format for Airflow * Fix resources param in kubernetespodoperator, add clarifying comment
1 parent edf90f2 commit cc1f10a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

composer/workflows/kubernetes_pod_operator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# [START composer_kubernetespodoperator]
1818
import datetime
1919
from airflow import models
20-
from airflow.contrib.kubernetes import pod
2120
from airflow.contrib.kubernetes import secret
2221
from airflow.contrib.operators import kubernetes_pod_operator
2322

@@ -200,7 +199,14 @@
200199
annotations={'key1': 'value1'},
201200
# Resource specifications for Pod, this will allow you to set both cpu
202201
# and memory limits and requirements.
203-
resources=pod.Resources().__dict__,
202+
# Prior to Airflow 1.10.4, resource specifications were
203+
# passed as a Pod Resources Class object,
204+
# If using this example on a version of Airflow prior to 1.10.4,
205+
# import the "pod" package from airflow.contrib.kubernetes and use
206+
# resources = pod.Resources() instead passing a dict
207+
# For more info see:
208+
# https://github.com/apache/airflow/pull/4551
209+
resources={'limit_memory': 1, 'limit_cpu': 1},
204210
# Specifies path to kubernetes config. If no config is specified will
205211
# default to '~/.kube/config'. The config_file is templated.
206212
config_file='/home/airflow/composer_kube_config',

composer/workflows/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apache-airflow[gcp_api]==1.10.5
1+
apache-airflow[gcp]==1.10.5
22
kubernetes==10.0.1
33
scipy==1.3.1
44
numpy==1.17.2

0 commit comments

Comments
 (0)