ctsit / redcapcustodian

Simplified, automated data management on REDCap systems
Other
13 stars 6 forks source link

Adding `sink()` to `init_etl()` #100

Open pbchase opened 1 year ago

pbchase commented 1 year ago

We want to dump all of the R log to test files to ensure a complete run/crash log. We will do these things:

Note, the discussion about this feature has underscored the value of using docker-compose and yaml files to run these containers. That will be addressed in another issue.

ljwoodley commented 6 months ago

Would this be an option? This is an example with render_report.R run locally. Output attached.

docker run --rm --env-file .env \
  -v $(pwd):/home/rocker/redcapcustodian \
  redcapcustodian /bin/bash -c "Rscript report/render_report.R \
  report/sample_report.Rmd > /home/rocker/redcapcustodian/$(date +%Y%m%d-%H%M%S)-sample_report.log 2>&1"

20240311-192047-sample_report.log

ChemiKyle commented 6 months ago

Separate goal of switching out docker run ... crons to docker compose:

docker-compose.yaml

version: '3.8'

services:
  redcapcustodian:
    container_name: redcapcustodian
    env_file:
      - /path/to/default.env
    environment:
      - FOO=${FOO}
    image: redcapcustodian
    restart: "no"
    volumes:
      - /path/to/host/dir:/mnt/homedir

new cron format:

* * * * * root docker compose -f /path/to/redcapcustodian/docker-compose.yaml --env-file /path/to/override.env run --rm redcapcustodian Rscript report/sample_report.Rmd 

Note that override.env does not seem to actually end up replacing variables sourced from Sys.getenv if they aren't also specified in the "environment" section; however, using -e KEY=var in the docker compose string after run does work (--env-file cannot be placed after run). This is not the case for docker compose up.

ljwoodley commented 5 months ago

Is this proceeding with the docker compose solution?

pbchase commented 5 months ago

On 2024-04-30 @ljwoodley, @pbc, and @saipavan10-git discussed using https://airflow.apache.org/docs/apache-airflow/stable/index.html to manage our redcapcustodian tasks. @ljwoodley will do a proof of concept to run one workflow under airflow and produce a log file.