From 7be6a472cf0f1f4981f3253e63ae10dc21411e43 Mon Sep 17 00:00:00 2001 From: Peter Powers <pmpowers@usgs.gov> Date: Thu, 19 Jan 2023 14:30:48 -0700 Subject: [PATCH] build run edits --- docs/pages/Building-&-Running.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/docs/pages/Building-&-Running.md b/docs/pages/Building-&-Running.md index 77c51d06..421b8cdb 100644 --- a/docs/pages/Building-&-Running.md +++ b/docs/pages/Building-&-Running.md @@ -38,17 +38,18 @@ To run *nshmp-haz* web services: ```bash ./gradlew run +# or './gradlew run -t' to recompile and relaunch when code changes ``` By default, when the web services start up, they load the 2018 NSHM for the conterminous U.S. To use a different model run the web services using Java and specify model path: ```bash +./gradlew assemble java -jar build/libs/nshmp-haz.jar --model=path/to/model ``` -After startup, web services and documentation are now available at -[http://localhost:8080/](http://localhost:8080/). +After startup, web services and documentation are available at <http://localhost:8080/>. See the [Matlab](../../etc/matlab) directory for examples of how to call the web services. To run the ground motion model (GMM) web services, please use the @@ -89,6 +90,32 @@ Disaggregations build on and output `HazardCalc` results along with other disagg files. Disaggregations also have some independent [configuration](./Calculation-Configuration.md#calculation-configuration-parameters) options. +## Customizing Code + +Whereas *nshmp-haz* contains code to run command line applications and web services, model +loading and hazard calculations are handled in the dependent library +[*nshmp-lib*](https://code.usgs.gov/ghsc/nshmp/nshmp-lib). To use a local, modified version of +*nshmp-lib*, set an environment variable `NSHMP_LIB_LOCAL=true` and *nshmp-haz* +will look for *nshmp-lib* in a directory adjacent to *nshmp-haz*. If *nshmp-lib* is located +somewhere else, modify the path specified in +[`gradle/dependencies.gradle`](../../gradle/dependencies.gradle). When using a local version +of *nshmp-lib*, first build the *nshmp-lib* project using `./gradlew fatJar` so that +required dependencies are included. + +Summary of steps to check out and start running code for local development: + +```bash +# --> Set a NSHMP_LIB_LOCAL=true environment variable on your system +cd yourProjectDirectory +git clone https://code.usgs.gov/ghsc/nshmp/nshmp-lib.git +cd nshmp-lib +./gradlew fatJar +cd .. +git clone https://code.usgs.gov/ghsc/nshmp/nshmp-ws.git +cd nshmp-ws +./gradlew run +``` + --- ## Related Pages -- GitLab