Skip to content
abaezacastro edited this page Feb 22, 2019 · 3 revisions

Building containerized computational models

Organize the codebase

  1. create / adopt a standardized filesystem layout
  2. change code to use relative paths for all input / output file operations
  3. ???

Formalize dependencies with Docker and platform-specific tools

For NetLogo, we focus on supporting a Linux / Ubuntu AMD64 build and X11 - also need to check for any external extensions dependencies that should be included inline

For R, first we need to determine what dependencies exist and set packrat to track them.

Using packrat to manage and install R dependencies:

@cpritcha was experiencing issues with packrat not storing a package in the packrat snapshot properly which turned out to be a bug in configuration (the glm package was being ignored).

general finding all dependencies packaging flow:

install.packages("packrat")
packrat::init(infer.dependencies=FALSE)
install.packages("devtools")
devtools::install_github("bbolker/glmmADMB")

Then call packrat::snapshot which will return a error listing all the missing packages. Copy that list of missing packages into a vector.

packages <- c('BBmisc', 'BH', 'DT', 'ParamHelpers', 'RColorBrewer', 'RJSONIO', 'RcppArmadillo', 'base64enc', 'bindr', 'bindrcpp', 'checkmate', 'colorspace', 'crosstalk', 'data.table', 'dplyr', 'ecr', 'fansi', 'fastmatch', 'gbm', 'ggplot2', 'gramEvol', 'gridExtra', 'gtable', 'hexbin', 'htmltools', 'htmlwidgets', 'httpuv', 'labeling', 'later', 'lazyeval', 'leaflet', 'maptools', 'markdown', 'mco', 'misc3d', 'munsell', 'parallelMap', 'pillar', 'pkgconfig', 'plogr', 'plot3D', 'plotly', 'png', 'promises', 'pscl', 'purrr', 'raster', 'reshape2', 'scales', 'shiny', 'shinydashboard', 'shinythemes', 'smoof', 'sourcetools', 'sp', 'tibble', 'tidyr', 'tidyselect', 'utf8', 'viridis', 'viridisLite', 'xtable', 'yaml')

Then install those missing packages

install.packages(packages)

and call packrat::snapshot() to save the lock file. Save the lock file. Now dependencies are properly tracked.

Link to UNAM repository: https://github.com/sostenibilidad-unam/SHV