Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions openml/tasks/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/test_runs/test_run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def test_run_and_upload_gridsearch(self):
assert len(run.trace.trace_iterations) == 9

@pytest.mark.sklearn()
@pytest.mark.skip(reason="failures_issue_1544")
def test_run_and_upload_randomsearch(self):
randomsearch = RandomizedSearchCV(
RandomForestClassifier(n_estimators=5),
Expand Down