tirkarthi commented on issue #37709:
URL: https://github.com/apache/airflow/issues/37709#issuecomment-1964329406

   I am unable to reproduce this with below dag which on execution pushes 2 to 
xcom from some_task_0 task. Can you please add a simple standalone dag without 
third party dependencies to reproduce this issue? Can you please check logs to 
see if the bash command was executed to show output in logs?
   
   
https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/operators/bash/index.html#airflow.operators.bash.BashOperator
   
   > If BaseOperator.do_xcom_push is True, the last line written to stdout will 
also be pushed to an XCom when the bash command completes
   
   Sample log : 
   
   ```
   [2024-02-26, 14:45:32 UTC] {subprocess.py:63} INFO - Tmp dir root location: 
/tmp
   [2024-02-26, 14:45:32 UTC] {subprocess.py:75} INFO - Running command: 
['/usr/bin/bash', '-c', 'echo 2']
   [2024-02-26, 14:45:32 UTC] {subprocess.py:86} INFO - Output:
   [2024-02-26, 14:45:32 UTC] {subprocess.py:93} INFO - 2
   [2024-02-26, 14:45:32 UTC] {subprocess.py:97} INFO - Command exited with 
return code 0
   ```
   
   ```python
   from datetime import datetime, timedelta
   
   from airflow import DAG
   from airflow.operators.bash import BashOperator
   
   from datetime import timedelta
   
   with DAG(
       dag_id="gh_37709",
       start_date=datetime(2023, 10, 10),
       catchup=False,
       schedule_interval="@daily",
   ) as dag:
   
       cmd2 = "echo 2"
   
       dbt_task = BashOperator(task_id="some_task_0", bash_command=cmd2, 
do_xcom_push=True)
   
       dbt_task
   ```


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