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/04/12 14:05:50 UTC

[GitHub] [airflow] ephraimbuddy commented on a diff in pull request #22941: Allow users to control task_ids in decorated task more

ephraimbuddy commented on code in PR #22941:
URL: https://github.com/apache/airflow/pull/22941#discussion_r848479465


##########
airflow/decorators/base.py:
##########
@@ -255,6 +255,21 @@ def __attrs_post_init__(self):
         self.kwargs.setdefault('task_id', self.function.__name__)
 
     def __call__(self, *args, **kwargs) -> XComArg:
+
+        task_id = kwargs.pop('task_id', None)
+        owner = kwargs.pop('owner', None)
+        email = kwargs.pop('email', None)
+        pool = kwargs.pop('pool', None)
+        priority_weight = kwargs.pop('priority_weight', None)
+        new_params = {
+            'task_id': task_id,
+            'owner': owner,
+            'email': email,
+            'pool': pool,
+            'priority_weight': priority_weight,
+        }
+        self.kwargs.update({k: v for k, v in new_params.items() if v is not None})
+

Review Comment:
   Hi @ashb, this is one way I have found that we could allow more `Baseoperator` arguments. Let me know if this looks good and I'll expand on it. 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