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/01 03:14:54 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #21077: Kubernetes decorator

uranusjr commented on a change in pull request #21077:
URL: https://github.com/apache/airflow/pull/21077#discussion_r796235482



##########
File path: airflow/decorators/__init__.pyi
##########
@@ -126,7 +126,22 @@ class TaskDecoratorCollection:
             such as transmission a large amount of XCom to TaskAPI.
         """
     @overload
-    def virtualenv(self, python_callable: Function) -> Function: ...
+    def virtualenv(self, python_callable: F) -> F: ...

Review comment:
       Why is this line changed? There is no `F`.

##########
File path: airflow/decorators/__init__.pyi
##########
@@ -126,7 +126,22 @@ class TaskDecoratorCollection:
             such as transmission a large amount of XCom to TaskAPI.
         """
     @overload
-    def virtualenv(self, python_callable: Function) -> Function: ...
+    def virtualenv(self, python_callable: F) -> F: ...
+    def kubernetes(
+        self, python_callable: Optional[Callable] = None, multiple_outputs: Optional[bool] = None, **kwargs
+    ) -> TaskDecorator:
+        """Wraps a function to be executed on a k8s pod using KubernetesPodOperator
+
+        Also accepts any argument that KubernetesPodOperator will via ``kwargs``.
+
+        :param python_callable: Function to decorate
+        :type python_callable: Optional[Callable]
+        :param multiple_outputs: if set, function return value will be
+            unrolled to multiple XCom values. List/Tuples will unroll to xcom values
+            with index as key. Dict will unroll to xcom values with keys as XCom keys.
+            Defaults to False.
+        :type multiple_outputs: bool
+        """

Review comment:
       This should explicitly spell out most (or all) of the arguments on `KubernetesPodOperator`, like `docker` below.
   
   Also, can you move this to after `docker`? This better separates built-in and provider-installed decorators.




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