vjdorazio / TwoRavens

A web application for data exploration, statistical analysis, model construction and meta analysis tools, that integrates with Zelig and Dataverse.
http://datascience.iq.harvard.edu/tworavens
Other
1 stars 4 forks source link

source('rooksource.R) hangs when CRAN repo is offline #10

Closed aaron-lebo closed 7 years ago

aaron-lebo commented 7 years ago

I was trying to run the R server today and it would get to "Loading required packages: XML" and hang for minutes at a time and never return an error. While digging through rooksource.R, noticed that when it is run in development, it always updates packages, and currently it does that from a single URL which is down today, which causes the source() call to hang indefinitely.

It was easy to fix by commenting out that line, but maybe we should pick a more stable repo (haven't had the issue until today), or only update.packages when necessary instead of every run.

tercer commented 7 years ago

I've added code that finds all the presently available CRAN mirrors, and then randomly selects one in the USA that is https, with this commit: b2274719f4137533e646e5a2e6caadade5f9da73

There would still be an issue if you were missing a package that the code needed, but no CRAN mirrors were available (perhaps you were offline). I could come up with a softer crash than to hang.

Note, that present behavior first checks whether a package exists, then installs those that do not exist, and then updates any that are behind the version in the CRAN mirror. So update.packages is only updating those that are out of date.

aaron-lebo commented 7 years ago

That's awesome. Softer crash would be a bonus but with that patch should avoid all but the craziest errors. Thanks @tercer.