aces / cbrain-plugins-neuro

5 stars 20 forks source link

Destroying a DataladDataProvider should clean up associated DataladSystemSubset files #289

Open prioux opened 1 month ago

prioux commented 1 month ago

When a DataladDataProvider is destroyed, it might leave behind in the database one or many userfiles of type DataladSystemSubset.

These userfiles represent caching information for the datalad dasets; they are registered in the ScratchDataProvider and the userfiles all have names like TopDatalad.rr=5.dp=411.

The name of the DataladSystemSubset is an encoding. The rr=ID is the ID of the remote resource where the cache is located (because ScratchDataProvider content it local to each CBRAIN resource). The dp=ID is the actual ID of the associated DataladDataProvider.

We need a cleaner callback that, when a DataladDataProvider is destroyed, would also destroy all its associated DataladSystemSubset userfiles. They would be recognized by the dp=ID part in their names.

These scratch userfiles can simply be destroyed even they are officially on another remote resource, because CBRAIN's data cache cleaner will erase the leftover files eventually.