Currently, the f-API expects that the local_nb_nodes.json file always exists (although it can handle when the file is empty).
In a docker compose setting, the f-API container exists silently (unless you examine the logs) when the file does not exist. This is because:
The docker compose recipe auto-mounts local_nb_nodes.json into the container, but if the file does not exist an empty directory is simply created (so there is no error from Docker itself)
The current f-API code does check if the path exists and if the contents are not empty (by checking path byte size), and only proceeds to parse the local nodes if these conditions are met:
However, on different filesystems such as Ubuntu, empty directories can apparently have a nonzero byte size due to filesystem overhead (!). So, this edge case actually causes the conditions to be met when someone launches our Compose recipe w/o a local_nb_nodes.json file, which then errors out inside the conditional b/c a file is expected.
To ensure the f-API can still be launched in the above scenario, we should have it check explicitly if:
Currently, the f-API expects that the local_nb_nodes.json file always exists (although it can handle when the file is empty).
In a docker compose setting, the f-API container exists silently (unless you examine the logs) when the file does not exist. This is because:
The current f-API code does check if the path exists and if the contents are not empty (by checking path byte size), and only proceeds to parse the local nodes if these conditions are met:
https://github.com/neurobagel/federation-api/blob/1d34c057053a63f984d85c6d1326dfb97de6a870/app/api/utility.py#L71-L77
However, on different filesystems such as Ubuntu, empty directories can apparently have a nonzero byte size due to filesystem overhead (!). So, this edge case actually causes the conditions to be met when someone launches our Compose recipe w/o a local_nb_nodes.json file, which then errors out inside the conditional b/c a file is expected.
To ensure the f-API can still be launched in the above scenario, we should have it check explicitly if: