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 2022/01/05 10:05:00 UTC

[GitHub] [airflow] uranusjr opened a new pull request #20671: Allow depending to a @task_group as a whole

uranusjr opened a new pull request #20671:
URL: https://github.com/apache/airflow/pull/20671


   Instead of always using the task returned by the task group function as the dependency representation, also allow a task group function to *not* return any task specifically.
   
   Setting dependency to such a group would depend on the group's contained tasks as a whole, and not any specific task in it.
   
   This renders this DAG definition taken from https://github.com/apache/airflow/issues/19903#issuecomment-1004105943 (which would fail to parse currently)
   
   ```python
   @dag(start_date=datetime(2023, 1, 1), schedule_interval="@once")
   def test_dag_1():
       @task
       def start():
           pass
   
       @task
       def do_thing(x):
           print(x)
   
       @task_group
       def do_all_things():
           do_thing(1)
           do_thing(2)
   
       @task
       def end():
           pass
   
       start() >> do_all_things() >> end()
   
   my_dag = test_dag_1()
   ```
   
   like this:
   
   ![image](https://user-images.githubusercontent.com/605277/148199155-c3e7fd20-e340-4003-88d0-ff3bea636cdd.png)
   
   Tests to come later.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] josh-fell commented on pull request #20671: Allow depending to a @task_group as a whole

Posted by GitBox <gi...@apache.org>.
josh-fell commented on pull request #20671:
URL: https://github.com/apache/airflow/pull/20671#issuecomment-1007614330


   Doesn't need to be in this PR but it might be nice to have some documentation on these two behaviors with the `@task_group` decorator. 
   
   @uranusjr I can log a request for this if you don't want to take this up. Let me know.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr commented on pull request #20671: Allow depending to a @task_group as a whole

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


   I created #20762 to track documentation changes.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr merged pull request #20671: Allow depending to a @task_group as a whole

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


   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] josh-fell commented on pull request #20671: Allow depending to a @task_group as a whole

Posted by GitBox <gi...@apache.org>.
josh-fell commented on pull request #20671:
URL: https://github.com/apache/airflow/pull/20671#issuecomment-1007614330






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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr commented on pull request #20671: Allow depending to a @task_group as a whole

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


   I created #20762 to track documentation changes.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] uranusjr merged pull request #20671: Allow depending to a @task_group as a whole

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


   


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] josh-fell commented on pull request #20671: Allow depending to a @task_group as a whole

Posted by GitBox <gi...@apache.org>.
josh-fell commented on pull request #20671:
URL: https://github.com/apache/airflow/pull/20671#issuecomment-1007619143


   Actually looks like this would be all new documentation on the `@task_group` decorator. I can't find any docs in 2.2.3 that outline the feature (at least not easily) and no docs seem to reference the `[START/END howto_task_group_decorator]` markers in the `example_task_group_decorator` DAG too.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] github-actions[bot] commented on pull request #20671: Allow depending to a @task_group as a whole

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


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] github-actions[bot] commented on pull request #20671: Allow depending to a @task_group as a whole

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


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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



[GitHub] [airflow] josh-fell commented on a change in pull request #20671: Allow depending to a @task_group as a whole

Posted by GitBox <gi...@apache.org>.
josh-fell commented on a change in pull request #20671:
URL: https://github.com/apache/airflow/pull/20671#discussion_r779263453



##########
File path: airflow/decorators/task_group.py
##########
@@ -92,9 +92,23 @@ def factory(*args, **kwargs):
                 *task_group_bound_args.args,
                 add_suffix_on_collision=True,
                 **task_group_bound_args.kwargs,
-            ):
+            ) as task_group:
                 # Invoke function to run Tasks inside the TaskGroup
-                return f(*args, **kwargs)
+                f_retval = f(*args, **kwargs)
+
+            # If 'f' returns a task, bind dependencies to it. Equilvanet to

Review comment:
       ```suggestion
               # If 'f' returns a task, bind dependencies to it. Equivalent to
   ```




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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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