uranusjr commented on a change in pull request #21077:
URL: https://github.com/apache/airflow/pull/21077#discussion_r791437497
##########
File path: airflow/decorators/__init__.pyi
##########
@@ -126,7 +126,25 @@ 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: ...
+ @overload
+ def kubernetes(
+ python_callable: Optional[Callable] = None, multiple_outputs:
Optional[bool] = None, **kwargs
+ ) -> TaskDecorator:
Review comment:
This is wrong; again, see the documentation and the Docker decorator.
##########
File path: airflow/decorators/__init__.py
##########
@@ -22,6 +22,7 @@
from airflow.decorators.python_virtualenv import virtualenv_task
from airflow.decorators.task_group import task_group
from airflow.models.dag import dag
+from airflow.providers.cncf.kubernetes.decorators.kubernetes import
kubernetes_task
Review comment:
This can’t be done like this here because the user may not have the
kubernetes provider installed. You need to use the provider mechanism to
declare the decorator. See [development
documentation](https://airflow.apache.org/docs/apache-airflow/stable/howto/create-custom-decorator.html)
for a more detailed explaination, and how the `@task.docker` decorator is
implemented as an example.
##########
File path: airflow/utils/python_kubernetes_script.jinja2
##########
@@ -0,0 +1,44 @@
+{#
Review comment:
This entire file should be placed in the kubernetes provider.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]