This repo is a docker wrapper around NatCap's InVEST: https://github.com/natcap/invest.
Currently the focus is on running the pollination model but it could easily be adapted to run any of the other models.
The image is built and deployed on DockerHub so you don't need to clone this repo to run it. You only need to clone if you're going to do some development.
We use a version scheme for GitHub and DockerHub tags: {our version}_{InVEST version}
, for example 1.0.0_3.4.2
means 1.0.0 is our version and we're using
version 3.4.2 of InVEST. Check DockerHub for the latest tag.
The image contains all the data it needs to run the pollination model, we just want to mount a volume so we can get the results on the host.
mkdir /tmp/output
# it takes less than 2 minutes to run usually
docker run \
--rm \
-it \
-v /tmp/output:/workspace \
ternandsparrow/natcap-invest-docker:1.1.3_3.8.9
sudo chown -R `id -u` /tmp/output
# now browse to /tmp/output to see the output files
We use the -it
flag so we get log output in a timely manner. You can leave it
out but the log messages don't seem to be flushed until the end of the run.
The build is fully automated and will download everything it needs.
tagVersion=1.1.3_3.8.9 # TODO change this to suit
cd natcap-invest-docker/
docker build -t ternandsparrow/natcap-invest-docker:$tagVersion
# see above for how to run it
We can use ptvsd to let us connect a remote debugger (like vscode) to the Docker container. You can do it like this:
- clone this repo
- make sure your local code exactly matches the code inside the container
(use
git checkout <some tag>
for an easy way to sync with a tagged docker container). It doesn't seem to matter if you have the dependencies installed on your host, the sources must be pulled from the docker container. - open your debugger, let's assume vscode because we already have the
launch.json
configured in this repo. Make sure you have this repo/project/directory open in vscode - launch the docker container, as you would above, but with these additional
parameters
-e PTVSD_ENABLE=1 -p 3000:3000
. This will set the env var to enable remote debugging and open a port to connect to the debug server - the container will enable remote debugging and wait for your debugger to attach. Once attached, we trigger a breakpoint so you can set your own breakpoints before execution continues
- move sample data from
/data/pollination
to/data/pollination-sample
- update to
3.8.9
of InVEST - update docker base image to one with that is still supported and has 2.x GDAL
- fix the entrypoint
- add remote (outside container) debugging capability
- move to version 3.8.0 of invest
- using python 3.7 now, not that if affects the external facing API of our app
- streamline install of python requirements
- move to version 3.6.0 of invest (model runtimes seem to have doubled)