etalab-ia / piaf-ml

PIAF v2.0 repo for ML development. Main purpose of this repo is to automatically find the best configuration for a QA pipeline of a partner organisation.
MIT License
8 stars 0 forks source link

Creating dirs that already exist ? #2

Closed psorianom closed 3 years ago

psorianom commented 4 years ago

We create a new directory if the file ./results/results.csv does not exist. The problem is that the folder results may already exist so this will fail with Exception File already exists.

https://github.com/etalab-ia/piaf-ml/blob/296c5abd93753d2026292885324a749909ecee72/src/evaluation/retriever_25k_eval.py#L180

I propose this change :

    if result_file_path.exists():
        df_old = pd.read_csv(result_file_path)
        df_results = pd.concat([df_old, df_results])
    else:
        if not result_file_path.parent.exists():
            result_file_path.parent.mkdir()
guillim commented 3 years ago

Sounds good to me

psorianom commented 3 years ago

:+1: already in master. I will close this .