You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "insomnes (via GitHub)" <gi...@apache.org> on 2025/02/04 10:01:38 UTC

[I] Add `@task.kubernetes_cmd` decorator to run returned command [airflow]

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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add `@task.kubernetes_cmd` decorator to run returned command [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil closed issue #46414: Add `@task.kubernetes_cmd` decorator to run returned command
URL: https://github.com/apache/airflow/issues/46414


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


Re: [I] Add `@task.kubernetes_cmd` decorator to run returned command [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #46414:
URL: https://github.com/apache/airflow/issues/46414#issuecomment-2654938386

   Feel free.


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


Re: [I] Add `@task.kubernetes_cmd` decorator to run returned command [airflow]

Posted by "insomnes (via GitHub)" <gi...@apache.org>.
insomnes commented on issue #46414:
URL: https://github.com/apache/airflow/issues/46414#issuecomment-2652146583

   I would be happy to work on this feature if there are no objections 


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