Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Aug 29, 2018
1 parent cf43e7d commit eeed404
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,24 @@ From R
devtools::install_github("eWaterCycle/bmi-r")
```

# Usage
For Python runner
```bash
pip install grpc4bmi[R]
```

# Serve the model using grpc4bmi

First the model should be wrapped in a basic model interface be subclassing the AbstractBmi class.
Then the server can be started with:

```
pip install grpc4bmi[R]
run-bmi-server --lang R --name <path to r script with bmi class>.<bmi class name>
run-bmi-server --lang R --path <path to r script with bmi class> --name <bmi class name>
```

## Docker container

So for example for https://github.com/ClaudiaBrauer/WALRUS

```Dockerfile
FROM r-base

RUN installGithub.r ClaudiaBrauer/WALRUS eWaterCycle/bmi-r
So for example for [WALRUS](https://github.com/ClaudiaBrauer/WALRUS) model, see its [Dockerfile](https://github.com/eWaterCycle/grpc4bmi-examples/blob/master/walrus/Dockerfile).

RUN mkdir /opt/walrus-bmi

COPY walrus-bmi.r /opt/walrus-bmi/walrus-bmi.r

WORKDIR /opt/walrus-bmi

RUN apt update && apt install -y python3-dev python3-pip && pip3 install grpc4bmi[R]
CMD run-bmi-server --lang R --name walrus-bmi.WalrusBmi --path /opt/walrus-bmi --port 55555
EXPOSE 55555
```

To run server use
```bash
docker run -d -v $PWD:/data -p 55555:55555 <docker image from ewatercycle/grpc4bmi-r>
```
The config file for the bmi initialize function should be put in current working directory and the initialize function should be called with `/data/<config filename`.

# Release
Expand All @@ -59,5 +43,4 @@ Rscript -e "devtools::document(roclets=c('rd', 'collate', 'namespace'))"
```bash
Rscript -e 'devtools::document()'
R CMD INSTALL .
Rscript -e 'grpc4bmi::run()'
```

0 comments on commit eeed404

Please sign in to comment.