From commits-return-12036-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Fri Jan 12 19:03:06 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id A82EA180621 for ; Fri, 12 Jan 2018 19:03:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 988C7160C43; Fri, 12 Jan 2018 18:03:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B92A0160C20 for ; Fri, 12 Jan 2018 19:03:05 +0100 (CET) Received: (qmail 93058 invoked by uid 500); 12 Jan 2018 18:03:04 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 93042 invoked by uid 99); 12 Jan 2018 18:03:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jan 2018 18:03:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 562A51A10E2 for ; Fri, 12 Jan 2018 18:03:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.231 X-Spam-Level: X-Spam-Status: No, score=-4.231 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 1agZea7YuvDj for ; Fri, 12 Jan 2018 18:03:03 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 9AF415F6C8 for ; Fri, 12 Jan 2018 18:03:02 +0000 (UTC) Received: (qmail 92783 invoked by uid 99); 12 Jan 2018 18:03:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jan 2018 18:03:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B2BCEE9457; Fri, 12 Jan 2018 18:03:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bolke@apache.org To: commits@airflow.incubator.apache.org Date: Fri, 12 Jan 2018 18:03:06 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/16] incubator-airflow git commit: [AIRFLOW-1517] Remove authorship of resources [AIRFLOW-1517] Remove authorship of resources Collaboration authors got destroyed when splitting up a PR, this commit removes code which will be readded in the next commit to restore authorship Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/ada7aed0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/ada7aed0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/ada7aed0 Branch: refs/heads/master Commit: ada7aed0da1e84e2fc7b217295d6160a6764f787 Parents: cde3a5f Author: GRANT NICHOLAS Authored: Thu Dec 28 14:38:28 2017 -0600 Committer: Daniel Imberman Committed: Thu Jan 11 15:28:33 2018 -0800 ---------------------------------------------------------------------- .../kubernetes_request_factory.py | 33 ++------------------ airflow/contrib/kubernetes/pod.py | 19 ----------- 2 files changed, 2 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ada7aed0/airflow/contrib/kubernetes/kubernetes_request_factory/kubernetes_request_factory.py ---------------------------------------------------------------------- diff --git a/airflow/contrib/kubernetes/kubernetes_request_factory/kubernetes_request_factory.py b/airflow/contrib/kubernetes/kubernetes_request_factory/kubernetes_request_factory.py index 9398bef..7d698b4 100644 --- a/airflow/contrib/kubernetes/kubernetes_request_factory/kubernetes_request_factory.py +++ b/airflow/contrib/kubernetes/kubernetes_request_factory/kubernetes_request_factory.py @@ -37,10 +37,6 @@ class KubernetesRequestFactory: def extract_image(pod, req): req['spec']['containers'][0]['image'] = pod.image - @staticmethod - def extract_image_pull_policy(pod, req): - if pod.image_pull_policy: - req['spec']['containers'][0]['imagePullPolicy'] = pod.image_pull_policy @staticmethod def add_secret_to_env(env, secret): @@ -73,9 +69,7 @@ class KubernetesRequestFactory: if len(pod.node_selectors) > 0: req['spec']['nodeSelector'] = pod.node_selectors - @staticmethod - def attach_volumes(pod, req): - req['spec']['volumes'] = pod.volumes + @staticmethod def attach_volume_mounts(pod, req): @@ -119,30 +113,7 @@ class KubernetesRequestFactory: KubernetesRequestFactory.add_secret_to_env(env, secret) req['spec']['containers'][0]['env'] = env - @staticmethod - def extract_resources(pod, req): - if not pod.resources or pod.resources.is_empty_resource_request(): - return - - req['spec']['containers'][0]['resources'] = {} - - if pod.resources.has_requests(): - req['spec']['containers'][0]['resources']['requests'] = {} - if pod.resources.request_memory: - req['spec']['containers'][0]['resources']['requests'][ - 'memory'] = pod.resources.request_memory - if pod.resources.request_cpu: - req['spec']['containers'][0]['resources']['requests'][ - 'cpu'] = pod.resources.request_cpu - - if pod.resources.has_limits(): - req['spec']['containers'][0]['resources']['limits'] = {} - if pod.resources.request_memory: - req['spec']['containers'][0]['resources']['limits'][ - 'memory'] = pod.resources.limit_memory - if pod.resources.request_cpu: - req['spec']['containers'][0]['resources']['limits'][ - 'cpu'] = pod.resources.limit_cpu + @staticmethod def extract_init_containers(pod, req): http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ada7aed0/airflow/contrib/kubernetes/pod.py ---------------------------------------------------------------------- diff --git a/airflow/contrib/kubernetes/pod.py b/airflow/contrib/kubernetes/pod.py index 6a9f76d..cdb1d65 100644 --- a/airflow/contrib/kubernetes/pod.py +++ b/airflow/contrib/kubernetes/pod.py @@ -14,26 +14,7 @@ # limitations under the License. -class Resources: - def __init__( - self, - request_memory=None, - request_cpu=None, - limit_memory=None, - limit_cpu=None): - self.request_memory = request_memory - self.request_cpu = request_cpu - self.limit_memory = limit_memory - self.limit_cpu = limit_cpu - - def is_empty_resource_request(self): - return not self.has_limits() and not self.has_requests() - - def has_limits(self): - return self.limit_cpu is not None or self.limit_memory is not None - def has_requests(self): - return self.request_cpu is not None or self.request_memory is not None class Pod: