mlcommons / medperf

An open benchmarking platform for medical artificial intelligence using Federated Evaluation.
https://www.medperf.org
Apache License 2.0
146 stars 32 forks source link

[BUG] Empty .jwks file causes sign-in errors #582

Open aristizabal95 opened 7 months ago

aristizabal95 commented 7 months ago

Describe the bug In some strange edge cases, the .jwks file that resides in ~/.medperf_config/.tokens can end up empty. When that happens, Authentication fails, as medperf tries to read this file as a JSON object and can't figure out how to parse empty files.

To Reproduce

  1. Create an empty .jwks file in ~/.medperf_config/.tokens. Rename the previos one if needed
  2. Sign out of medperf.
  3. Try to sign back in. A JSONDecodeError will be raised.

Expected behavior While the expected behavior should be to completely avoid generating empty .jwks file, a good additional behavior is to try to read the file and if it fails remove the corrupted one an regenerate it.