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/02/23 08:28:32 UTC

[GitHub] [airflow] uranusjr opened a new pull request #21754: Rename operator mapping map() to apply()

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


   According to the design discussion, we’re going to use `map()` for something else that matches more closely to the FP `map` concept.
   
   Do we also want to rename `mapped_kwargs` to something else? (What?)


-- 
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 #21754: Rename operator mapping map() to apply()

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


   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] uranusjr merged pull request #21754: Rename operator mapping map() to apply()

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


   


-- 
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 a change in pull request #21754: Rename operator mapping map() to apply()

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



##########
File path: airflow/decorators/task_group.py
##########
@@ -106,12 +107,16 @@ def _make_task_group(self, **kwargs) -> MappedTaskGroup:
         return tg
 
     def partial(self, **kwargs) -> "MappedTaskGroupDecorator[R]":
-        if self.partial_kwargs:
-            raise RuntimeError("Already a partial task group")
+        duplicated_keys = [k for k in kwargs if k in self.partial_kwargs]
+        if len(duplicated_keys):

Review comment:
       Ah, of course, thanks!




-- 
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] dstandish commented on a change in pull request #21754: Rename operator mapping map() to apply()

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



##########
File path: airflow/decorators/task_group.py
##########
@@ -106,12 +107,16 @@ def _make_task_group(self, **kwargs) -> MappedTaskGroup:
         return tg
 
     def partial(self, **kwargs) -> "MappedTaskGroupDecorator[R]":
-        if self.partial_kwargs:
-            raise RuntimeError("Already a partial task group")
+        duplicated_keys = [k for k in kwargs if k in self.partial_kwargs]
+        if len(duplicated_keys):

Review comment:
       ```suggestion
           if len(duplicated_keys) == 1:
   ```

##########
File path: airflow/decorators/task_group.py
##########
@@ -106,12 +107,16 @@ def _make_task_group(self, **kwargs) -> MappedTaskGroup:
         return tg
 
     def partial(self, **kwargs) -> "MappedTaskGroupDecorator[R]":
-        if self.partial_kwargs:
-            raise RuntimeError("Already a partial task group")
+        duplicated_keys = [k for k in kwargs if k in self.partial_kwargs]
+        if len(duplicated_keys):
+            raise ValueError(f"Cannot overwrite partial argument: {duplicated_keys[0]!r}")
+        elif duplicated_keys:
+            joined = ", ".join(repr(k) for k in duplicated_keys)
+            raise ValueError(f"Cannot overwrite partial arguments: {joined}")

Review comment:
       or alternatively... 
   
   ```suggestion
   duplicated_keys = [k for k in kwargs if k in self.partial_kwargs]
   if duplicated_keys:
       raise ValueError(f"Cannot overwrite partial arguments: {duplicated_keys!r}")
   ```
   
   personally i wouldn't sweat the grammar but different strokes :) 




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