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 2020/12/01 18:12:19 UTC

[GitHub] [airflow] dimberman opened a new pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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


   Creates a rule to ensure users have a 2.0 compatible hostname_callable
   configuration in their airflow.cfg
   
   addresses https://github.com/apache/airflow/issues/11044
   
   <!--
   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 commented on a change in pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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



##########
File path: tests/upgrade/rules/test_hostname_callable_rule.py
##########
@@ -0,0 +1,36 @@
+# 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.
+from unittest import TestCase
+
+from airflow.upgrade.rules.hostname_callable_rule import HostnameCallable
+from tests.test_utils.config import conf_vars
+
+
+class TestFernetEnabledRule(TestCase):
+    @conf_vars({("core", "hostname_callable"): "dummyhostname:function"})
+    def test_incorrect_hostname(self):
+        result = HostnameCallable().check()
+        self.assertEqual(
+            result,
+            "Error: hostname_callable dummyhostname:function "
+            "contains a colon instead of a dot. please change to dummyhostname.function",
+        )
+
+    @conf_vars({("core", "hostname_callable"): "dummyhostname.function"})

Review comment:
       @mik-laj oof good catch. Should I add the backwards compat in this PR?




----------------------------------------------------------------
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] ashb commented on a change in pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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



##########
File path: airflow/upgrade/rules/hostname_callable_rule.py
##########
@@ -0,0 +1,38 @@
+# 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.
+
+from __future__ import absolute_import
+
+from airflow.configuration import conf
+from airflow.upgrade.rules.base_rule import BaseRule
+
+
+class HostnameCallable(BaseRule):
+    title = "Unify hostname_callable option in core section"
+
+    description = ""
+
+    def check(self):
+        hostname_callable_conf = conf.get("core", "hostname_callable")
+        if ":" in hostname_callable_conf:
+            return (
+                "Error: hostname_callable {} "
+                "contains a colon instead of a dot. please change to {}".format(

Review comment:
       ```suggestion
                   "Error: hostname_callable `{}` "
                   "contains a colon instead of a dot. please change to `{}`".format(
   ```
   
   Then it gets formatted nicely.




----------------------------------------------------------------
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] ashb commented on a change in pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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



##########
File path: tests/upgrade/rules/test_hostname_callable_rule.py
##########
@@ -0,0 +1,36 @@
+# 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.
+from unittest import TestCase
+
+from airflow.upgrade.rules.hostname_callable_rule import HostnameCallable
+from tests.test_utils.config import conf_vars
+
+
+class TestFernetEnabledRule(TestCase):
+    @conf_vars({("core", "hostname_callable"): "dummyhostname:function"})
+    def test_incorrect_hostname(self):
+        result = HostnameCallable().check()
+        self.assertEqual(
+            result,
+            "Error: hostname_callable dummyhostname:function "
+            "contains a colon instead of a dot. please change to dummyhostname.function",
+        )
+
+    @conf_vars({("core", "hostname_callable"): "dummyhostname.function"})

Review comment:
       2.0 will read the 1.10 style config value and upgrade-in-memory+warn. https://github.com/apache/airflow/commit/ce50538503a4e670830ff26cfa42c162049e9253




----------------------------------------------------------------
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 #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, 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 pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #12743:
URL: https://github.com/apache/airflow/pull/12743#issuecomment-737382458


   @dimberman :
   ```
   E       AssertionError: 'Erro[92 chars]ge to `dummyhostname.function`' != 'Erro[92 chars]ge to `dummyhostname.function`.This will be deprecated in 2.0.'
   E       - Error: hostname_callable `dummyhostname:function` contains a colon instead of a dot. please change to `dummyhostname.function`
   E       + Error: hostname_callable `dummyhostname:function` contains a colon instead of a dot. please change to `dummyhostname.function`.This will be deprecated in 2.0.
   E       ?                                                                                                                               ++++++++++++++++++++++++++++++++
   
   tests/upgrade/rules/test_hostname_callable_rule.py:29: AssertionError
   ```


----------------------------------------------------------------
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] mik-laj commented on a change in pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12743:
URL: https://github.com/apache/airflow/pull/12743#discussion_r533662683



##########
File path: tests/upgrade/rules/test_hostname_callable_rule.py
##########
@@ -0,0 +1,36 @@
+# 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.
+from unittest import TestCase
+
+from airflow.upgrade.rules.hostname_callable_rule import HostnameCallable
+from tests.test_utils.config import conf_vars
+
+
+class TestFernetEnabledRule(TestCase):
+    @conf_vars({("core", "hostname_callable"): "dummyhostname:function"})
+    def test_incorrect_hostname(self):
+        result = HostnameCallable().check()
+        self.assertEqual(
+            result,
+            "Error: hostname_callable dummyhostname:function "
+            "contains a colon instead of a dot. please change to dummyhostname.function",
+        )
+
+    @conf_vars({("core", "hostname_callable"): "dummyhostname.function"})

Review comment:
       Personally, I don't think it's necessary to make this change to Airflow 1.10. When the user updates Airflow to version 2.0, everything still works, so we don't have to worry too much to make this change in Airflow 1.10. It is critical to discover all the breaking changes in airflow upgrade-check.  All changes that are not breaking are nice-to-have.




----------------------------------------------------------------
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 #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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


   [The Workflow run](https://github.com/apache/airflow/actions/runs/396834027) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
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] mik-laj commented on a change in pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12743:
URL: https://github.com/apache/airflow/pull/12743#discussion_r533638924



##########
File path: tests/upgrade/rules/test_hostname_callable_rule.py
##########
@@ -0,0 +1,36 @@
+# 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.
+from unittest import TestCase
+
+from airflow.upgrade.rules.hostname_callable_rule import HostnameCallable
+from tests.test_utils.config import conf_vars
+
+
+class TestFernetEnabledRule(TestCase):
+    @conf_vars({("core", "hostname_callable"): "dummyhostname:function"})
+    def test_incorrect_hostname(self):
+        result = HostnameCallable().check()
+        self.assertEqual(
+            result,
+            "Error: hostname_callable dummyhostname:function "
+            "contains a colon instead of a dot. please change to dummyhostname.function",
+        )
+
+    @conf_vars({("core", "hostname_callable"): "dummyhostname.function"})

Review comment:
       Is this the correct value for Airflow 1.10? I imagine that we are able to ensure compatibility between the new and the old value at the same time. This will facilitate migrations as users will not have to change everything in one step, but they will be able to fix and test each value step by step.




----------------------------------------------------------------
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 merged pull request #12743: Create HostnameCallableRule to ease upgrade to Airflow 2.0

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


   


----------------------------------------------------------------
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