Beispiel #1
0
def clean(benchmark, token=None, filename='all'):

    benchmark = Benchmark(benchmark)
    # Delete result files
    output_folder = benchmark.get_output_folder()
    if output_folder.exists() and filename == 'all':
        print(f"rm -rf {output_folder}")
        rm_folder(output_folder)
    else:
        was_removed = False
        for ext in [".csv", ".html", ".parquet"]:
            if ext == ".html":
                to_remove = output_folder / f"{benchmark.name}_{filename}"
            else:
                to_remove = output_folder / filename
            file = to_remove.with_suffix(ext)
            if file.exists():
                was_removed = True
                print(f"rm {file}")
                file.unlink()
            json_path = output_folder / "cache_run_list.json"
            if was_removed and json_path.exists():
                print(f"Removing {filename}.{ext} entry from {json_path}")
                with open(json_path, "r") as cache_run:
                    json_file = json.load(cache_run)
                json_file.pop(f"{filename}.{ext}", None)
                with open(json_path, "w") as cache_run:
                    json.dump(json_file, cache_run)
    # Delete cache files
    print("Clear joblib cache")
    benchmark.mem.clear(warn=False)
Beispiel #2
0
def clean(benchmark, token=None, filename=None):

    benchmark = Benchmark(benchmark)

    # Delete result files
    output_folder = benchmark.get_output_folder()
    print(f"rm -rf {output_folder}")
    rm_folder(output_folder)

    # Delete cache files
    cache_folder = benchmark.get_cache_location()
    print(f"rm -rf {cache_folder}")
    rm_folder(cache_folder)