OasisLMF / OasisPlatform

Loss modelling platform.
BSD 3-Clause "New" or "Revised" License
40 stars 17 forks source link

Clean up loading of Piwind scaling / chunking settings. #1043

Open sambles opened 4 months ago

sambles commented 4 months ago

Issue Description

The example piwind model stores optional JSON files

These are intended to be picked up at by a model registration script (when deployed to a cluster), however that script expects these files to be in the models root directory.

https://github.com/OasisLMF/OasisPlatform/blob/626469d0adeadafa6da3fd5a554cfd24cf08c3fd/kubernetes/charts/oasis-models/resources/model_registration.sh#L14-L15

There is a workaround in the piwind deployment script to copy these from <root>/meta-data/*.json -> <root>/*.json https://github.com/OasisLMF/OasisAzureDeployment/blob/05561827d6ab51d03f1f3095dbe0be86bfe62d01/deploy.sh#L642-L643

Pick a single location and make it consistent.

carlfischerjba commented 4 months ago

Thanks for logging this. A related improvement would be to allow these paths to be overridden via environment variables. This would allow a bit more flexibility and an easy workaround if some models want to keep these files separate from the model data (which might be a good thing to do anyway).

CHUNKING_CONFIGURATION_FILE="${OASIS_CHUNKING_CONFIGURATION_PATH:-$OASIS_MODEL_DATA_DIRECTORY/chunking_configuration.json}" 
SCALING_CONFIGURATION_FILE="${OASIS_SCALING_CONFIGURATION_PATH:-$OASIS_MODEL_DATA_DIRECTORY/scaling_configuration.json}"