ontoportal-lirmm / ncbo_cron

Jobs that run on a regular basis in the NCBO infrastructure
Other
0 stars 6 forks source link

Do a ruby script that remove data and files of a submission range (from "id1" to "id2" ) of an ontology. #4

Closed syphax-bouazzouni closed 2 years ago

syphax-bouazzouni commented 2 years ago

The need

A script given an "ontology acronym" and a range of submission ids ( from "submission id" to "submission id" ), removes all the data (triple store) and files of the submissions inside that range.

Use case

From "stageportal" server, inside the "/srv/ontoportal/ncbo_cron" folder. The following command :

[ontoportal@stageportal ncbo_cron]$ bin/ncbo_ontology_submissions_eradicate -o MDRFRE --from 2 --to 5

Will :

  1. show you the list of all submissions that will be affected(removed).
  2. ask you to confirm (by typing "y'" for yes or "n" for no) if you want to remove (the data and files) of all the submission between 2 (included) and 5 (included).

Important: after the script a cache refresh is needed to see the result.

Details

jonquet commented 2 years ago

Script to be suggested to NCBO as a pull request.

syphax-bouazzouni commented 2 years ago

A bug was found : In some case (still to determine) the content (files) of the folders are removed but the folder remains

syphax-bouazzouni commented 2 years ago

The bug was that I used the wrong ruby function to remove files, I used rm_r , that remove only files. Instead of remove_dir that remove dirs and there contents

The hotfix was made at https://github.com/ontoportal-lirmm/ncbo_cron/commit/5f6fd0862476c4e2f3a797572630abc2969e53dc

The hotfix wasn't tested in production, so I close this issue for now. But we will see in the future if the problem remains.