Skip to content

Commit

Permalink
Merge pull request #427 from bclayton-usgs/docker-models
Browse files Browse the repository at this point in the history
Use local model with Docker
  • Loading branch information
pmpowers-usgs committed Jun 1, 2019
2 parents 9556830 + 8b0e433 commit 82d4fee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
# -v /absolute/path/to/output:/app/output \
# usgs/nshmp-haz
#
# Usage with custom model:
# docker run \
# -e PROGRAM=<deagg | deagg-epsilon | deagg-iml | hazard | hazard-2018 | rate> \
# -e ACCESS_VISUALVM=<true | false> \
# -e VISUALVM_PORT=<port> \
# -e VISUALVM_HOSTNAME=<hostname> \
# -e MOUNT_MODEL=true \
# -v /absolute/path/to/model:/app/model \
# -v /absolute/path/to/sites/file:/app/sites.<geojson | csv> \
# -v /absolute/path/to/config/file:/app/config.json \
# -v /absolute/path/to/output:/app/output \
# usgs/nshmp-haz
#
# Note: Models load as requested. While all supported models are
# available, requesting them all will eventually result in an
# OutOfMemoryError. Increase -Xmx to -Xmx16g or -Xmx24g, if available.
Expand Down Expand Up @@ -90,6 +103,9 @@ ENV JAVA_XMX 8g
# NSHM
ENV MODEL ""

# Whether to mount the model instead of selecting a model
ENV MOUNT_MODEL false

# Program to run: deagg | deagg-epsilon | hazard | rate
ENV PROGRAM hazard

Expand Down
10 changes: 8 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ readonly USAGE="
# (string) JAVA_XMS - Java initial memory
# (string) JAVA_XMX - Java max memory
# (string) MODEL - The nshm
# (boolean) MOUNT_MODEL - Whether to mount the model instead of selecting model
# (string) PROGRAM - The program to run
# (number) RETURN_PERIOD - The return period for deagg
# Arguments:
Expand All @@ -72,8 +73,13 @@ main() {
local nshmp_program="${GET_NSHMP_PROGRAM_RETURN}";

# Get model path
get_model_path 2> ${LOG_FILE};
local nshmp_model_path="${GET_MODEL_PATH_RETURN}";
local nshmp_model_path="";
if [ ${MOUNT_MODEL} = true ]; then
nshmp_model_path="model";
else
get_model_path 2> ${LOG_FILE};
nshmp_model_path="${GET_MODEL_PATH_RETURN}";
fi

# Check site file
check_sites_file 2> ${LOG_FILE};
Expand Down

0 comments on commit 82d4fee

Please sign in to comment.