Skip to content

Resolve "sms cv data needs to be queried via rest api"

Closes Issue #70 (closed)

What does the MR do?

Implementation of cron scheduling`

  • define new generic service cron-scheduler for scheduling periodic tasks

  • run cron-scheduler only if CRON_SETUP_SERVICE=true

  • initialize SMS/CV remote tables in database depending on SMS_ACCESS_TYPE/CV_ACCESS_TYPE

    • if ..._ACCESS_TYPE=api, foreign tables are not initialized by database but will be created and updated by update_..._tables.py script via cron scheduling
    • first task implemented: update/sync tables in database via sms-cv rest api
    • not yet implemented but will follow in another MR: upate/sync tables via sms rest api
  • using the aforementioned new environment variables:

    name value used in service
    SMS_ACCESS_TYPE db/api database, cron-scheduler
    CV_ACCESS_TYPE db/api database, cron-scheduler
    CRON_SETUP_SERVICE true/false cron-scheduler
  • built with Dockerfile with entrypoint tini, executing ./cron-entrypoint.sh

  • cron-entrypoint.sh:

    • exit service if CRON_SETUP_SERVICE=false
    • prepend environment variables to crontab (to make them available for cron), start cron service

Check if sms_cv sync works correctly with docker compose exec database psql -c "SELECT * FROM sms_cv_measured_quantity;" This should return a table with data.

For testing it might make sense to change the cron-expression to * * * * * in the crontab.txt

A bit of clean-up

  • pass image tags also to services built with Dockerfiles (database, tomcat, cron-scheduler)
  • use updated SMS-URL and CV-URL
  • switch group of demo user in frontend/user.json to allow to login to frontend with AAI after django fixture is loaded (with docker compose exec -T frontend python3 manage.py loaddata user.json thing.json)
    • group Test exists in dev-AAI and produces a primary key error if user is part of that group as it is already present in frontend database
Edited by Joost Hemmen

Merge request reports

Loading