diff --git a/R/tasks/main.yml b/R/tasks/main.yml index 8a22d0b..2563b93 100644 --- a/R/tasks/main.yml +++ b/R/tasks/main.yml @@ -1,5 +1,5 @@ --- -- include: r-packages_cleanup.yml +- import_tasks: r-packages_cleanup.yml when: r_packages_cleanup -- include: r-installation.yml -- include: r-packages-updater.yml +- import_tasks: r-installation.yml +- import_tasks: r-packages-updater.yml diff --git a/R/templates/update_r_packages.sh.j2 b/R/templates/update_r_packages.sh.j2 index 448b4f3..bed888d 100644 --- a/R/templates/update_r_packages.sh.j2 +++ b/R/templates/update_r_packages.sh.j2 @@ -78,10 +78,10 @@ function init_env() { OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' ) RETVAL=$? if [ $RETVAL -eq 0 ] ; then - logger "update_r_packages: $OLDPROC_RUNNING" - OLDPROC_RUNNING_TIME=$( ps -o etimes= -p ${PROCNUM} ) - if [ $OLDPROC_RUNNING_TIME > $UPDATER_PROCESS_MAX_RUNTIME ] ; then - logger "update_r_packages: process $OLDPROC_RUNNING got stuck, killing it" + logger "update_r_packages: pid of the already running process: $OLDPROC_RUNNING" + OLDPROC_RUNNING_TIME=$( ps -o etimes= -p ${OLDPROC_RUNNING} ) + if [ $OLDPROC_RUNNING_TIME -gt $UPDATER_PROCESS_MAX_RUNTIME ] ; then + logger "update_r_packages: process $OLDPROC_RUNNING was running for $OLDPROC_RUNNING_TIME seconds. Got stuck, killing it" kill -9 $OLDPROC_RUNNING cleanup else @@ -198,9 +198,12 @@ function r_github_pkgs() { for l in $( cat $R_PKGS_GITHUB ) ; do pkg=$( echo $l | cut -d "/" -f 2 ) if [ "$ACTION" == "upgrade" ] ; then - Rscript --slave --no-save --no-restore-history -e "require(devtools); require(methods); install_github('$l');" + #Rscript --slave --no-save --no-restore-history -e "require(devtools); require(methods); install_github('$l');" + Rscript --slave --no-save --no-restore-history -e "require(devtools); require(methods); require(jsonlite) ; package_to_install <- '$l' ; refs <- jsonlite::read_json(sprintf('https://api.github.com/repos/%s/releases', package_to_install)) ; ref_to_install <- 'master'; if(length(refs)>0) { ref_to_install <- refs[[1]][['tag_name']] } ; devtools::install_github(package_to_install, ref = ref_to_install)" + else - Rscript --slave --no-save --no-restore-history -e "if (! ('$pkg' %in% installed.packages()[,'Package'])) { require(devtools); require(methods) ; install_github('$l'); }" + #Rscript --slave --no-save --no-restore-history -e "if (! ('$pkg' %in% installed.packages()[,'Package'])) { require(devtools); require(methods) ; install_github('$l'); }" + Rscript --slave --no-save --no-restore-history -e "if (! ('$pkg' %in% installed.packages()[,'Package'])) { require(devtools); require(methods); require(jsonlite) ; package_to_install <- '$l' ; refs <- jsonlite::read_json(sprintf('https://api.github.com/repos/%s/releases', package_to_install)) ; ref_to_install <- 'master'; if(length(refs)>0) { ref_to_install <- refs[[1]][['tag_name']] } ; devtools::install_github(package_to_install, ref = ref_to_install) }" fi done else