From 43fcc0777e53252f270994dc4215790a9e61dc65 Mon Sep 17 00:00:00 2001 From: nuwang <2070605+nuwang@users.noreply.github.com> Date: Wed, 21 Feb 2024 12:48:02 +0530 Subject: [PATCH 1/3] Use gxadmin for cleanup --- roles/galaxy-pg-cleanup/tasks/main.yml | 9 +-------- .../galaxy-pg-cleanup/templates/run_cleanup.sh.j2 | 14 -------------- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 roles/galaxy-pg-cleanup/templates/run_cleanup.sh.j2 diff --git a/roles/galaxy-pg-cleanup/tasks/main.yml b/roles/galaxy-pg-cleanup/tasks/main.yml index c06bef8b1..30e8b129e 100644 --- a/roles/galaxy-pg-cleanup/tasks/main.yml +++ b/roles/galaxy-pg-cleanup/tasks/main.yml @@ -1,10 +1,3 @@ -- name: Template run_cleanup.sh script - template: - src: run_cleanup.sh.j2 - dest: /home/galaxy/run_cleanup.sh - mode: "744" - owner: galaxy - group: galaxy - name: Add cron job for galaxy cron: name: "galaxy_pg_cleanup" @@ -12,4 +5,4 @@ weekday: "{{ galaxy_pg_cleanup_cron_weekday }}" hour: "{{ galaxy_pg_cleanup_cron_hour }}" minute: "00" - job: bash /home/galaxy/run_cleanup.sh 2>> /home/galaxy/pgcleanup.log + job: gxadmin galaxy cleanup 10 diff --git a/roles/galaxy-pg-cleanup/templates/run_cleanup.sh.j2 b/roles/galaxy-pg-cleanup/templates/run_cleanup.sh.j2 deleted file mode 100644 index a2556150d..000000000 --- a/roles/galaxy-pg-cleanup/templates/run_cleanup.sh.j2 +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -cd {{ galaxy_server_dir }} - -. {{ galaxy_venv_dir }}/bin/activate - -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml delete_userless_histories -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml delete_exported_histories -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml purge_deleted_histories -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml purge_deleted_hdas -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml purge_historyless_hdas -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml purge_hdas_of_purged_histories -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml delete_datasets -python ./scripts/cleanup_datasets/pgcleanup.py -o 10 -c {{ galaxy_config_dir }}/galaxy.yml purge_datasets \ No newline at end of file From 4f1c05e399c3658187630b45ebe8a3852d806ce8 Mon Sep 17 00:00:00 2001 From: nuwang <2070605+nuwang@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:10:00 +0530 Subject: [PATCH 2/3] Add log dir env var --- roles/galaxy-pg-cleanup/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/galaxy-pg-cleanup/tasks/main.yml b/roles/galaxy-pg-cleanup/tasks/main.yml index 30e8b129e..1ace608c2 100644 --- a/roles/galaxy-pg-cleanup/tasks/main.yml +++ b/roles/galaxy-pg-cleanup/tasks/main.yml @@ -5,4 +5,4 @@ weekday: "{{ galaxy_pg_cleanup_cron_weekday }}" hour: "{{ galaxy_pg_cleanup_cron_hour }}" minute: "00" - job: gxadmin galaxy cleanup 10 + job: GALAXY_LOG_DIR=/var/log/galaxy gxadmin galaxy cleanup 10 From c8d79c7bb7992361b12ac268c9f1924f870f1f71 Mon Sep 17 00:00:00 2001 From: cat-bro Date: Thu, 22 Feb 2024 09:05:51 +1100 Subject: [PATCH 3/3] add more env --- roles/galaxy-pg-cleanup/tasks/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/galaxy-pg-cleanup/tasks/main.yml b/roles/galaxy-pg-cleanup/tasks/main.yml index 1ace608c2..e5d53625e 100644 --- a/roles/galaxy-pg-cleanup/tasks/main.yml +++ b/roles/galaxy-pg-cleanup/tasks/main.yml @@ -1,3 +1,9 @@ +- name: Create log directory that galaxy can write to + file: + state: directory + path: /var/log/galaxy + owner: galaxy + group: galaxy - name: Add cron job for galaxy cron: name: "galaxy_pg_cleanup" @@ -5,4 +11,4 @@ weekday: "{{ galaxy_pg_cleanup_cron_weekday }}" hour: "{{ galaxy_pg_cleanup_cron_hour }}" minute: "00" - job: GALAXY_LOG_DIR=/var/log/galaxy gxadmin galaxy cleanup 10 + job: ". {{ galaxy_venv_dir }}/bin/activate; GALAXY_LOG_DIR=/var/log/galaxy GALAXY_ROOT={{ galaxy_server_dir }} GALAXY_CONFIG_FILE={{ galaxy_config_file }} /usr/local/bin/gxadmin galaxy cleanup 10"