fdb icon indicating copy to clipboard operation
fdb copied to clipboard

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

Open kinow opened this issue 2 years ago • 2 comments

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

kinow avatar Jul 21 '23 07:07 kinow

@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)

tlmquintino avatar Jul 21 '23 08:07 tlmquintino

@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 !

kinow avatar Jul 21 '23 08:07 kinow