From 7179d4b9e63b5949006693eb0bf6c68d2cb7dd7e Mon Sep 17 00:00:00 2001 From: JATAYU000 Date: Wed, 31 Dec 2025 11:13:06 +0530 Subject: [PATCH 1/2] Only remove newly added --- openml/tasks/functions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openml/tasks/functions.py b/openml/tasks/functions.py index d2bf5e946..e9b879ae4 100644 --- a/openml/tasks/functions.py +++ b/openml/tasks/functions.py @@ -415,8 +415,9 @@ def get_task( if not isinstance(task_id, int): raise TypeError(f"Task id should be integer, is {type(task_id)}") - tid_cache_dir = openml.utils._create_cache_directory_for_id(TASKS_CACHE_DIR_NAME, task_id) - + cache_key_dir = openml.utils._create_cache_directory_for_id(TASKS_CACHE_DIR_NAME, task_id) + tid_cache_dir = cache_key_dir / str(task_id) + tid_cache_dir_existed = tid_cache_dir.exists() try: task = _get_task_description(task_id) dataset = get_dataset(task.dataset_id, **get_dataset_kwargs) @@ -430,7 +431,8 @@ def get_task( if download_splits and isinstance(task, OpenMLSupervisedTask): task.download_split() except Exception as e: - openml.utils._remove_cache_dir_for_id(TASKS_CACHE_DIR_NAME, tid_cache_dir) + if not tid_cache_dir_existed: + openml.utils._remove_cache_dir_for_id(TASKS_CACHE_DIR_NAME, tid_cache_dir) raise e return task From 9889bbf23b171e9395c4c24e95009e223e591db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20Kir=C3=A1ly?= Date: Wed, 31 Dec 2025 10:26:14 +0100 Subject: [PATCH 2/2] Update test_run_functions.py --- tests/test_runs/test_run_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_runs/test_run_functions.py b/tests/test_runs/test_run_functions.py index 3bb4b0a0c..37f478fa7 100644 --- a/tests/test_runs/test_run_functions.py +++ b/tests/test_runs/test_run_functions.py @@ -822,7 +822,7 @@ def test_run_and_upload_gridsearch(self): assert len(run.trace.trace_iterations) == 9 @pytest.mark.sklearn() - @pytest.mark.xfail(reason="failures_issue_1544") + @pytest.mark.skip(reason="failures_issue_1544") def test_run_and_upload_randomsearch(self): randomsearch = RandomizedSearchCV( RandomForestClassifier(n_estimators=5),