We are using airflow to run a C++ program through BashOperator. We want to see the standard output and standard error given by this C++ program from aiflow's Log page. But the logs are not shown up. A very simple C++ code to test:
#include <iostream>
int main()
{
while(true)
{
std::cout << "Test\n";
sleep(1);
}
}
BashOperator:
bash_task=BashOperator(
task_id="demo_bash_task",
dag=dag,
bash_command='/tmp/cpptest'
)
However, if I run the bash script below through BashOperator, I can see the logs will be continuouly printed on the Log page in Airflow
#!/bin/bash
while :
do
echo "Test"
sleep 1
done
My question is, why there are different behavior between C++ and bash programs to airflow. To me they both do the standard output. How can I make C++ program work.