You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/15 20:04:15 UTC

[GitHub] [airflow] dimberman opened a new pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

dimberman opened a new pull request #15388:
URL: https://github.com/apache/airflow/pull/15388


   Currently, the xcom sidecar container for the KubernetesPodOperator will
   sleep for 30 seconds before checking if the xcom has completed. This is
   far too long of a wait, as a 1 second wait will ensure that the process
   is not consistently blocked.
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman merged pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman merged pull request #15388:
URL: https://github.com/apache/airflow/pull/15388


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614375941



##########
File path: UPDATING.md
##########
@@ -70,6 +70,11 @@ https://developers.google.com/style/inclusive-documentation
 
 -->
 
+### Deprecated PodDefaults and in airflow.kubernetes.pod_generator
+
+We have moved PodDefaults and add_xcom_sidecar to `airflow.providers.cncf.kubernetes.utils.xcom_sidecar`.
+This change will allow us to modify the KubernetesPodOperator XCom functionality without requiring airflow upgrades.

Review comment:
       @kaxil fixed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614363822



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.
+"""
+import copy
+
+from kubernetes.client import models as k8s
+
+MAX_LABEL_LEN = 63
+
+
+class PodDefaults:

Review comment:
       @kaxil I would love some guidance on how to start deleting or deprecating. the pod_generator_deprecated was brought over for certain backcompat functions from 1.10.  I think we could potentially delete the one in pod_generator and import from pod_generator_deprecated?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614361356



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.
+"""
+import copy
+
+from kubernetes.client import models as k8s
+
+MAX_LABEL_LEN = 63
+
+
+class PodDefaults:

Review comment:
       Does this mean we have 2/3 PodDefaults:
   
   1) there
   2) https://github.com/apache/airflow/blob/adb505d0f9414f5b604c3f5505cd908ef5f77f96/airflow/kubernetes/pod_generator.py#L45-L63
   
   and 
   
   3) Deprecated module:
   
   https://github.com/apache/airflow/blob/adb505d0f9414f5b604c3f5505cd908ef5f77f96/airflow/kubernetes/pod_generator_deprecated.py#L36-L54




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614369965



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614376150



##########
File path: UPDATING.md
##########
@@ -70,6 +70,11 @@ https://developers.google.com/style/inclusive-documentation
 
 -->
 
+### Deprecated PodDefaults and in airflow.kubernetes.pod_generator

Review comment:
       @kaxil fixed. Trying to keep up with your comments :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614371685



##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -157,6 +136,10 @@ def gen_pod(self) -> k8s.V1Pod:
     @staticmethod
     def add_xcom_sidecar(pod: k8s.V1Pod) -> k8s.V1Pod:
         """Adds sidecar"""
+        warnings.warn(
+            "This function is deprecated. "
+            "Please use airflow.providers.cncf.kubernetes.utils.xcom_sidecar.add_xcom_sidecar instead"

Review comment:
       added




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614359522



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.
+"""
+import copy
+
+from kubernetes.client import models as k8s
+
+MAX_LABEL_LEN = 63

Review comment:
       This isn't used anywhere




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614374558



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.
+"""
+import copy
+
+from kubernetes.client import models as k8s
+
+MAX_LABEL_LEN = 63
+
+
+class PodDefaults:

Review comment:
       @kaxil sounds good




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614373846



##########
File path: UPDATING.md
##########
@@ -70,6 +70,11 @@ https://developers.google.com/style/inclusive-documentation
 
 -->
 
+### Deprecated PodDefaults and in airflow.kubernetes.pod_generator

Review comment:
       'and in' ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#issuecomment-820746611


   The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614374056



##########
File path: UPDATING.md
##########
@@ -70,6 +70,11 @@ https://developers.google.com/style/inclusive-documentation
 
 -->
 
+### Deprecated PodDefaults and in airflow.kubernetes.pod_generator
+
+We have moved PodDefaults and add_xcom_sidecar to `airflow.providers.cncf.kubernetes.utils.xcom_sidecar`.
+This change will allow us to modify the KubernetesPodOperator XCom functionality without requiring airflow upgrades.

Review comment:
       We should add the original location too -- that it is moved from XYZ to ABC




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614368958



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,60 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.
+"""
+import copy
+
+from kubernetes.client import models as k8s
+
+MAX_LABEL_LEN = 63
+
+
+class PodDefaults:

Review comment:
       Yeah we can only deprecared module in 3.0 unfortunately but your last commit should remove (2).
   
   Add a note in Updating.md too i.e if someone was relying on PodDefaults use one from `airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py`.
   
   And then we can chuck that out in 3.0




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dimberman merged pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
dimberman merged pull request #15388:
URL: https://github.com/apache/airflow/pull/15388


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614366935



##########
File path: airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py
##########
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module provides an interface between the previous Pod
+API and outputs a kubernetes.client.models.V1Pod.
+The advantage being that the full Kubernetes API
+is supported and no serialization need be written.

Review comment:
       Needs updating 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on a change in pull request #15388: Fix timeout when using XCom with KubernetesPodOperator

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #15388:
URL: https://github.com/apache/airflow/pull/15388#discussion_r614367905



##########
File path: airflow/kubernetes/pod_generator.py
##########
@@ -157,6 +136,10 @@ def gen_pod(self) -> k8s.V1Pod:
     @staticmethod
     def add_xcom_sidecar(pod: k8s.V1Pod) -> k8s.V1Pod:
         """Adds sidecar"""
+        warnings.warn(
+            "This function is deprecated. "
+            "Please use airflow.providers.cncf.kubernetes.utils.xcom_sidecar.add_xcom_sidecar instead"

Review comment:
       Worth adding a note in Updating.md too please




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org