insomnes opened a new issue, #46414:
URL: https://github.com/apache/airflow/issues/46414
### Description
There is bash decorator which allows neat and simple bash command (returned
str) execution. I want to add the same ability as `kubernetes_cmd` decorator.
### Use case/motivation
Decorator flow is short and simple way to run airflow tasks, it's also
superb in templating terms.
When you use airflow as orchestrator mostly to run commands in specific
images it would be nice to have something similar to bash operator:
```python
@task.bash
def also_run_this() -> str:
return 'echo "ti_key={{ task_instance_key_str }}"'
also_this = also_run_this()
```
Which will allow us not to run some python function (as current
`@task.kubernetes` do), but the command returned from function executed on
airflow Scheduler / Worker side:
```python
@task.kubernetes_cmd
def run_cmd_in_k8s_container() -> str:
return 'python /path/inside/image/main.py --some-option={{
task_instance_key_str }}""'
```
This may simplify tons of KubernetesPodOperator usages
### Related issues
_No response_
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]