From 67ede2004e1ada08a77742b0efd9353a06a88ebc Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 11 Jan 2018 17:50:35 +0100 Subject: [PATCH] update_r_packages.sh: remove the lock files that install.packages() fails to delete. --- R/defaults/main.yml | 3 ++- R/tasks/r-packages-updater.yml | 2 +- R/templates/update_r_packages.sh.j2 | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/R/defaults/main.yml b/R/defaults/main.yml index a4c60926..3a848814 100644 --- a/R/defaults/main.yml +++ b/R/defaults/main.yml @@ -16,9 +16,10 @@ r_install_cran_repo: absent r_cran_set_default_mirror: True r_cran_mirror_site: https://cran.mirror.garr.it/mirrors/CRAN/ r_base_specific_version: False -r_base_pkg_version: 2.14.1 +r_base_pkg_version: 3.4.3 r_packages_main_state: present r_packages_state: '{{ r_packages_main_state }}' +r_sitelib_path: '/usr/local/lib/R/site-library' r_plugins_from_deb: True r_packages_cleanup: False # diff --git a/R/tasks/r-packages-updater.yml b/R/tasks/r-packages-updater.yml index 942e59b8..11c68f2e 100644 --- a/R/tasks/r-packages-updater.yml +++ b/R/tasks/r-packages-updater.yml @@ -7,7 +7,7 @@ file: dest={{ r_packages_svn_base_dir }} state=directory - name: Cron job that installs new R packages, if any - cron: name="install new R packages" user=root cron_file=install-r-packages minute="*/10" hour="5-0,1-2" job="/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1" state=present + cron: name="install new R packages" user=root cron_file=install-r-packages minute="*/10" hour="5-23,1-2" job="/usr/local/bin/update_r_packages install >/var/log/install_r_packages 2>&1" state=present - name: Cron job that upgrades existing R packages and installs new ones, if any cron: name="install new R packages" user=root cron_file=upgrade-r-packages minute="7" hour="3" job="/usr/local/bin/update_r_packages upgrade >/var/log/update_r_packages 2>&1" state=present diff --git a/R/templates/update_r_packages.sh.j2 b/R/templates/update_r_packages.sh.j2 index 4964943c..448b4f31 100644 --- a/R/templates/update_r_packages.sh.j2 +++ b/R/templates/update_r_packages.sh.j2 @@ -163,6 +163,11 @@ function debian_pkgs() { fi } +function remove_r_install_packages_lock_files() { + # install.packages leaves lock files around if the process crashes + rm -fr {{ r_sitelib_path }}/00LOCK-* + } + function r_cran_pkgs() { if [ $CRAN_PKGS_SKIP -eq 0 ] ; then logger "update_r_packages: Installing R packages from CRAN" @@ -221,6 +226,7 @@ else get_data_files fi debian_pkgs +remove_r_install_packages_lock_files r_cran_pkgs r_github_pkgs cleanup