Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #167 ...
syphax-bouazzouni opened this issue Jan 11, 2022 · 3 comments

Comments

@syphax-bouazzouni
Copy link

syphax-bouazzouni commented Jan 11, 2022

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

  • The arguments "from" and "to" are reversible, i.e. --from 2 --to 5 is equal to --from 5 --to 2
  • The script delete the submission folder(files) then the data
  • Only the archived "submissions" (not used in production) can be removed
@jonquet
Copy link

jonquet commented Jan 12, 2022

Script to be suggested to NCBO as a pull request.

@syphax-bouazzouni
Copy link
Author

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

@syphax-bouazzouni
Copy link
Author

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 5f6fd08

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.

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

No branches or pull requests

2 participants