Install Debian packages to run Airflow DAG

252 Views Asked by At

I'm running an Airflow DAG one of the operators is a BashOperator and relies on rosbag package in order to run. I installed airflow and rosbag in a VM in GCP, everything is working fine but when I trigger the DAG it keeps saying rosbag: command not found any idea how to solve it?

I've followed all the instructions in http://wiki.ros.org/Installation/Ubuntu

1

There are 1 best solutions below

1
On

As indicated in the link you cited when describing the environment setup, it is necessary to provide the necessary environment information in order to ROS work properly by source the appropriate script:

source /opt/ros/noetic/setup.bash

You can include it directly in your bash profile as suggested in the documentation.

In addition, you can do it as well in your BashOperator before trying performing the rosbag command invocation:

rosbag_task = BashOperator(
    task_id='rosbag',
    bash_command='source /opt/ros/noetic/setup.bash && rosbag ...',
    # ...
)