josh-fell commented on PR #30176:
URL: https://github.com/apache/airflow/pull/30176#issuecomment-1833047011

   One question I do have is should the `bash_command` attribute (aka the 
return value from the callable) be templated? Clearly `BashOperator` has this 
now, but with TaskFlow historically the args passed in to the callable can be 
templated. So should the behavior for this particular decorator stay the same? 
I've been wavering a little so does anyone have any thoughts?
   
   For example, with the `BashOperator` you can do:
   ```py
   BashOperator(task_id="bash", bash_command="echo 'ti={{ task_instance_key_str 
}}'")
   ```
   But should this be allowed with the decorator?
   ```py
   @task.bash
   def do_bash_things():
       return "echo 'ti={{ task_instance_key_str }}'"
   ```
   Or not, and users continue with the current TaskFlow approach of:
   ```py
   @task.bash
   def do_bash_things(task_instance_key_str=None):
       return f"echo 'ti={task_instance_key_str}'"
   ```
   
   Allowing a templated string to be returned is consistent with classic 
`BashOperator` authoring, but disallowing it seems to align with TaskFlow 
authoring generally. I'm leaning towards allowing it.


-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to