eWaterCycle / grpc4bmi

gRPC wrapper for model with a Basic modeling interface
https://grpc4bmi.readthedocs.io
Apache License 2.0
5 stars 4 forks source link

Mount dir inside container same as outside + have work directory. #93

Open sverhoeven opened 3 years ago

sverhoeven commented 3 years ago

The config file outside the container uses path which resolve on the host machine. Inside the container this path needs to mapped to /data/input. It would be nice if inside the container the same paths can be used.

Something like

client = BmiClientSingularity(image, input_dir='/shared/wflow/model-parameters', work_dir='/tmp/wflow-2000-2010')
client.initialize('wflow_sbm.ini')
client.update_until(client.get_end_time())
del client

Inside the container you would have

After model has run outside container you could have model output like logs for example /tmp/wflow-2000-2010/wflow.log.

Pros:

Cons:

sverhoeven commented 3 years ago

Be sure to document that only given dir and its sub-dirs can be seen inside container. Doing .. in container will give different results then outside.

nielsdrost commented 3 years ago

Should we complain if a mount "shadows" an existing path inside a container? e.g. if you create a folder with a path equal to the installation location of the model

sverhoeven commented 3 years ago

We would need look inside image to check if given dirs already exist. The only way I can think of is to spinup the container twice, first to check if given dirs already exist, and then start grpc4bmi server.

For it being a corner case and the amount of work I don't think it's wise to check if mounts shadow existing dirs.

sverhoeven commented 3 years ago

0.2.12 has been released with this issues implemented. However 0.3.x / master branch has not been updated.