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

   A casual example of how this could work can be taken from [this example 
tutorial](https://docs.astronomer.io/learn/bashoperator#example-run-a-script-in-another-programming-language)
 on using the BashOperator.
   
   Current:
   ```py
   get_ISS_coordinates = BashOperator(
           task_id="get_ISS_coordinates",
           bash_command="node $AIRFLOW_HOME/include/my_java_script.js"
       )
   
   print_ISS_coordinates = BashOperator(
       task_id="print_ISS_coordinates",
       bash_command="Rscript $AIRFLOW_HOME/include/my_R_script.R 
$ISS_COORDINATES",
       env={
           "ISS_COORDINATES": "{{ 
task_instance.xcom_pull(task_ids='get_ISS_coordinates') }}"
       },
       append_env=True
   )
   ```
   
   Using @task.bash:
   ```py
   @task.bash(append_env=True)
   def get_ISS_coordinates():
       return "node $AIRFLOW_HOME/include/my_java_script.js"
   
   @task.bash(append_env=True)
   def print_ISS_coordinates(coords):
       return f"Rscript $AIRFLOW_HOME/include/my_R_script.R {coords}"
   
   print_ISS_coordinates(coords=get_ISS_coordinates())
   ```


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

Reply via email to