openml-python icon indicating copy to clipboard operation
openml-python copied to clipboard

Fix: Use UserWarning for unauthenticated duplicate run checks (Fixes #1210)

Open Prachi194agrawal opened this issue 1 year ago • 1 comments

Description

This PR fixes #1210 by improving the warning message when avoid_duplicate_runs=True is used without an API key.

Changes:

  • Replaced the generic RuntimeWarning with a UserWarning.
  • Updated the warning message to explicitly inform the user that duplicate runs cannot be checked server-side without authentication.
  • Changed the condition check to explicitly look for openml.config.apikey is None.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I verified this locally by mocking openml.runs.run_model_on_task with apikey=None and asserting that the new UserWarning is triggered correctly.

Prachi194agrawal avatar Nov 18 '25 11:11 Prachi194agrawal

Hi @PGijsbers,

I have submitted this fix for #1210. I updated the warning to a UserWarning and added the specific check for the missing API key as discussed.

Could you please review this when you have a moment? It looks like the GitHub workflows (CI) are waiting for approval to run as well.

Thanks!

Prachi194agrawal avatar Nov 18 '25 11:11 Prachi194agrawal