Skip to content

Allow forcing a download even if cached files are already present #1132

Closed

Description

@PGijsbers

Sometimes cache has to be updated, and manually removing the cache directory to force a download is required. It would be nice to simply force a cache refresh from code.

Activity

  1. PGijsbers commented on Mar 28, 2022

    @PGijsbers
    MemberAuthor

    In the meanwhile, you can use this function (you can use the same arguments as get_dataset).

    import openml
    
    def force_get_dataset(dataset_id=None, *args, **kwargs):
        """ Remove any existing local files about `dataset_id` and then download new copies. """
        did_cache_dir = openml.utils._create_cache_directory_for_id(openml.datasets.functions.DATASETS_CACHE_DIR_NAME, dataset_id, )
        openml.utils._remove_cache_dir_for_id(openml.datasets.functions.DATASETS_CACHE_DIR_NAME, did_cache_dir)
        return openml.datasets.get_dataset(dataset_id, *args, **kwargs)
    
    if __name__ == "__main__":
        force_get_dataset(61)
  2. added this to the 0.14.0 milestone on Nov 29, 2022
  3. LennartPurucker commented on Jun 16, 2023

    @LennartPurucker
    Member

    This was resolved by PR #1260 by adding an option to refresh the cache to get_dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions