ecmwf / fdb

Fdb is a domain-specific object store for meteorological objects
Apache License 2.0
24 stars 11 forks source link

Warn users if the FDB config file was not found/loaded #13

Open kinow opened 1 year ago

kinow commented 1 year ago

Is your feature request related to a problem? Please describe.

Hi,

I have an FDB repo deployed on LUMI/CSC, and was trying to access it with a freshly created Singularity container that was tested on MN4/BSC.

It was not working due to a networking folder not being automatically mounted in LUMI, but it took me some minutes to realize what was happening.

It would be useful if FDB logged/warned users that it could not load the configuration file & its schema specified by the user, and instead tried to load the default $FDB_INSTALLATION/etc/fdb/schema.

Describe the solution you'd like

A WARNING maybe in stderr, or stdout alerting the user things might go wrong if they proceed…

Describe alternatives you've considered

It could be logged as debug, and visible only when running something like DEBUG=1 fdb-schema.

Additional context

The error in the singularity container:

bruno@uan01:~> singularity run --env FDB5_CONFIG_FILE=/scratch/folder/fdb-mirror/config.yaml my-container-fdb.sif fdb-schema
Exception: Cannot open /opt/fdb/etc/fdb/schema  (No such file or directory)
** Cannot open /opt/fdb/etc/fdb/schema  (No such file or directory) Caught in  (/usr/src/eckit/src/eckit/runtime/Tool.cc +32 start)
** Exception terminates fdb-schema

Organisation

BSC

tlmquintino commented 1 year ago

@kinow thanks for the report. Indeed this needs to be improved. However, the design of FDB is to throw an exception with the relevant error. In this case, if the env variable FDB5_CONFIG_FILE exists and if that file is not present, we should throw and Exception that should look something like: Cannot open FDB5_CONFIG_FILE /scratch/folder/fdb-mirror/config.yaml (No such file or directory)

kinow commented 1 year ago

@kinow thanks for the report. Indeed this needs to be improved. However, the design of FDB is to throw an exception with the relevant error. In this case, if the env variable FDB5_CONFIG_FILE exists and if that file is not present, we should throw and Exception that should look something like: Cannot open FDB5_CONFIG_FILE /scratch/folder/fdb-mirror/config.yaml (No such file or directory)

That'd work too! Thank you @tlmquintino !