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/10/15 10:09:45 UTC

[GitHub] [airflow] ashb opened a new pull request #11542: Rename (confusing) dag.sub_dag method to dag.partial_subset

ashb opened a new pull request #11542:
URL: https://github.com/apache/airflow/pull/11542


   There was a method on the DAG class called `sub_dag()` that had nothing
   to do with Sub-DAGs or the SubDagOperator - It instead created a new
   "partial" dag that contained only a selected subset of tasks.
   
   To remove this confusion when seeing `dag.sub_dag()` used in code I have
   renamed this function, and included a compat shim in case anyone is
   using it outside of Airflow core.
   
   
   <!--
   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] ashb commented on a change in pull request #11542: Rename (confusing) dag.sub_dag method to dag.partial_subset

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



##########
File path: airflow/models/dag.py
##########
@@ -1347,8 +1347,18 @@ def __deepcopy__(self, memo):
             result._log = self._log
         return result
 
-    def sub_dag(self, task_regex, include_downstream=False,
-                include_upstream=True):
+    def sub_dag(self, *args, **kwargs):
+        """This method is deprecated in favor of partial_subset"""
+        warnings.warn(
+            "This method is deprecated and will be removed in a future version. Please use partial_subset",
+            DeprecationWarning,
+            stacklevel=2,

Review comment:
       I kind of didn't on purpose - it's so rare to be used, and the UPDATING.md is so large already, and anyone who does will get a Depreciation warning whilst the code still works so...




----------------------------------------------------------------
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 merged pull request #11542: Rename (confusing) dag.sub_dag method to dag.partial_subset

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


   


----------------------------------------------------------------
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 #11542: Rename (confusing) dag.sub_dag method to dag.partial_subset

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



##########
File path: airflow/models/dag.py
##########
@@ -1347,8 +1347,18 @@ def __deepcopy__(self, memo):
             result._log = self._log
         return result
 
-    def sub_dag(self, task_regex, include_downstream=False,
-                include_upstream=True):
+    def sub_dag(self, *args, **kwargs):
+        """This method is deprecated in favor of partial_subset"""
+        warnings.warn(
+            "This method is deprecated and will be removed in a future version. Please use partial_subset",
+            DeprecationWarning,
+            stacklevel=2,

Review comment:
       Can we add this 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



[GitHub] [airflow] ashb commented on a change in pull request #11542: Rename (confusing) dag.sub_dag method to dag.partial_subset

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



##########
File path: airflow/models/dag.py
##########
@@ -1347,8 +1347,18 @@ def __deepcopy__(self, memo):
             result._log = self._log
         return result
 
-    def sub_dag(self, task_regex, include_downstream=False,
-                include_upstream=True):
+    def sub_dag(self, *args, **kwargs):
+        """This method is deprecated in favor of partial_subset"""
+        warnings.warn(
+            "This method is deprecated and will be removed in a future version. Please use partial_subset",
+            DeprecationWarning,
+            stacklevel=2,

Review comment:
       I kind of didn't on purpose - it's so rare to be used, and anyone who does will get a Depreciation warning




----------------------------------------------------------------
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 #11542: Rename (confusing) dag.sub_dag method to dag.partial_subset

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



##########
File path: airflow/models/dag.py
##########
@@ -1347,8 +1347,18 @@ def __deepcopy__(self, memo):
             result._log = self._log
         return result
 
-    def sub_dag(self, task_regex, include_downstream=False,
-                include_upstream=True):
+    def sub_dag(self, *args, **kwargs):
+        """This method is deprecated in favor of partial_subset"""
+        warnings.warn(
+            "This method is deprecated and will be removed in a future version. Please use partial_subset",
+            DeprecationWarning,
+            stacklevel=2,

Review comment:
       👍 Yea cool




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