Uh oh!
There was an error while loading. Please reload this page.
Kubernetes decorator - #21077
Conversation
…cutors" This reverts commit a1c532e.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
uranusjr
left a comment
There was a problem hiding this comment.
Also need to add image to the argument list of _KubernetesDecoratedOperator
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
| @@ -0,0 +1,44 @@ | |||
| {# | |||
There was a problem hiding this comment.
This has to be in the kube provider folder, else it won't get released with the provider, and it won't work.
@ashb , currently the decorator uses the write_python_script function thats in the utils/python_virtualenv.py file and thats why the template(python_kubernetes_script.jinja2) was also placed in the same folder. If we want to remove the dependency on the utils folder, I guess we can make a copy of the write_python_script in the cncf.providers.kubernetes folder. Question is if there a benefit of having a central place for the function and all templates, Docker decorator and python operator also call this function. |
Asciotti
commented
May 19, 2022
Bump? :) |
| @@ -0,0 +1,44 @@ | |||
| {# | |||
There was a problem hiding this comment.
Can you move this @subkanthi to the cncf kube providers please?
| pod_runtime_info_envs: Optional[List[PodRuntimeInfoEnv]] = None, | ||
| termination_grace_period: Optional[int] = None, | ||
| configmaps: Optional[List[str]] = None, | ||
| **kwargs, |
There was a problem hiding this comment.
What can go into kwargs here? It seems unnecessary.
| # Set defaults for name and namespace. | ||
| if 'name' not in kwargs: | ||
| kwargs['name'] = f'k8s_airflow_pod_{uuid.uuid4().hex}' | ||
| if 'namespace' not in kwargs: | ||
| kwargs['namespace'] = 'default' |
There was a problem hiding this comment.
Nit, it’s easier to use setdefault for these
| return res | ||
| T = TypeVar("T", bound=Callable) |
potiuk
commented
Sep 1, 2022
Closing, as this has been already implemented and merged in #25663 |
Decorator to execute functions in k8s using KubernetesPodOperator
closes: #19135
If no parameters passed, defaults are set in kubernetes.py
This version sets the function as an environment variable - PYTHON_SCRIPT and in the command , the logic is to retrieve the environment variable and write to '/tmp/script.py' to execute the function(very similar to Docker)
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.