An open API service indexing awesome lists of open source software.

https://github.com/csdms/cem-grpc4bmi

Run the CEM model through grpc4bmi
https://github.com/csdms/cem-grpc4bmi

bmi csdms docker grpc4bmi

Last synced: 4 months ago
JSON representation

Run the CEM model through grpc4bmi

Awesome Lists containing this project

README

          

[![Basic Model Interface](https://img.shields.io/badge/CSDMS-Basic%20Model%20Interface-green.svg)](https://bmi.readthedocs.io/)
[![DOI](https://zenodo.org/badge/1051324687.svg)](https://doi.org/10.5281/zenodo.17204796)
[![Test](https://github.com/csdms/cem-grpc4bmi/actions/workflows/test.yml/badge.svg)](https://github.com/csdms/cem-grpc4bmi/actions/workflows/test.yml)
[![Docker Hub](https://github.com/csdms/cem-grpc4bmi/actions/workflows/release.yml/badge.svg)](https://github.com/csdms/cem-grpc4bmi/actions/workflows/release.yml)
![Docker Image Version](https://img.shields.io/docker/v/csdms/cem-grpc4bmi)

# cem-grpc4bmi

Set up a [grpc4bmi](https://grpc4bmi.readthedocs.io) server
to run a containerized version
of the [CEM](https://csdms.colorado.edu/wiki/Model:CEM) model
through Python.

## Build

Build this example locally with:
```
docker build --tag cem-grpc4bmi .
```
The image is built on the [csdms/grpc4bmi](https://hub.docker.com/r/csdms/grpc4bmi) base image,
which is built on the [condaforge/miniforge3](https://hub.docker.com/r/condaforge/miniforge3) base image.
The OS is Linux/Ubuntu.
The CEM model, grpc4bmi, and the grpc4bmi server are installed in `/opt/conda`.
The CEM grpc4bmi server is exposed through port 55555.

## Run

Use the grpc4bmi Docker client to access the BMI methods of the containerized model.

Install with *pip*:
```
pip install grpc4bmi
```
Then, in a Python session, access CEM in the image built above with:
```python
from grpc4bmi.bmi_client_docker import BmiClientDocker

m = BmiClientDocker(image="cem-grpc4bmi", image_port=55555, work_dir=".")
m.get_component_name()

del m # stop container cleanly
```

If the image isn't found locally, it's pulled from Docker Hub
(e.g., try the `csdms/cem-grpc4bmi` image).

For more in-depth examples of running the CEM model through grpc4bmi,
see the [examples](./examples) directory.

## Developer notes

A versioned, multiplatform image is hosted on Docker Hub
at [csdms/cem-grpc4bmi](https://hub.docker.com/r/csdms/cem-grpc4bmi).
This image is automatically built and pushed to Docker Hub
with the [release](./.github/workflows/release.yml) CI workflow.
The workflow is only run when the repository is tagged.
To manually build and push an update, run:
```
docker buildx build --platform linux/amd64,linux/arm64 -t csdms/cem-grpc4bmi:latest --push .
```
A user can pull this image from Docker Hub with:
```
docker pull csdms/cem-grpc4bmi
```
optionally with the `latest` tag or with a version tag.

## Acknowledgment

This work is supported by the U.S. National Science Foundation under Award No. [2103878](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2103878), *Frameworks: Collaborative Research: Integrative Cyberinfrastructure for Next-Generation Modeling Science*.