Coscine Watchdog#

This app runs a flask webserver which awaits the csv files from ros to upload to NRW-RDS using coscine python sdk. See metadata to see the metadata that is added to the file.

Setup#

You will need to change the api-token to your token. Get one if you don’t yet have a coscine api-token.

export COSCINE_API_TOKEN="your_api_token"

In addition you need to get a uuid from: https://www.uuidgenerator.net/api/version4 Copy the id and export it to your system environment and always source these environment variables (that way all users use the same UUID):

Note

You need sudo priviledges for this.

echo 'ROBOT_UUID="your-uuid"' | sudo tee -a /etc/environment

In addition you need to export a brief description of the robot:

echo 'ROBOT_DESCRIPTION="your-robot-description"' | sudo tee -a /etc/environment
echo 'ROBOT_MANUFACTURER="your-robot-manufacturer"' | sudo tee -a /etc/environment
echo 'ROBOT_MODEL="your-robot-model"' | sudo tee -a /etc/environment

In addition you want to make sure the variables are available system-wide, including for services started by the system, you can add sourcing of /etc/environment to the Docker service environment file: Create or edit the /etc/systemd/system/docker.service.d/environment.conf file (create the directory if it doesn’t exist):

echo -e '\nif [ -f /etc/environment ]; then\n    . /etc/environment\nfi' | sudo tee -a /etc/profile
echo -e "\n# Source environment variables from /etc/environment\nif [ -f /etc/environment ]; then\n    . /etc/environment\nfi" | sudo tee -a /etc/bash.bashrc
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee -a /etc/systemd/system/docker.service.d/environment.conf <<EOF
[Service]
EnvironmentFile=/etc/environment
EOF

Furthermore, you need to restart the docker service to apply the changes:

sudo systemctl daemon-reload
sudo systemctl restart docker

Automated Behavior#

The flask http server on 0.0.0.0:5000 is opened. Once a file is posted to it, a connection with coscine is established. The file is tagged with meta data and pushed to NRW RDS WEB.

On SIGTERM (e.g. by means of docker compose down or crtl + c) the app gracefully shuts down. The graceful shutdown period is set to 10 seconds.