Deregister partially replaced multi-output plugins #775
+38
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the problem / what does the code in this PR do
Bad things happen if plugin A registers to make X and Y, then B registers to make just X.
For example, strax will first say B is producing X, as it should. Then you ask who is producing Y, it will say A. But now ask again who is producing X -- strax changes its mind and says A is producing X!
This happens because these 'partial registrations' break the assumptions of the plugin caching system. But that won't be all: if we actually tried to make Y the Processor shouldn't be smart enough to make two X's and throw away the bad one. Even if it was, would a user asking for X and Y really expect them to come from two different plugins?
Can you briefly describe how it works?
This PR ensures a plugin is completely deregistered once another plugin is registered to provide one of its outputs instead. In the example above, A would be completely deregistered and datatype Y would be no longer available in the context as soon as B registers to produce X.
Can you give a minimal working example (or illustrate with a figure)?
Surprisingly this happens in several places in straxen/cutax. For example:
gives
which makes no sense,
Fake1TDAQReader
is an ancient plugin. We only register it temporarily, then overwrite it with the actualDAQReader
. However, it is still registered forraw_records_diagnostic
, which does not exist in nT. When cutax asks for the lineage ofraw_records_diagnostic
on intialization, the plugin cache becomes polluted. If you actually try to make raw_records with this context, or even just do storage conversion, you will not go to space today.A similar thing happens for straxen's
PeakletClassificationSOM
(registers forsom_peaklet_data
andpeaklet_classification
, then another plugin takes overpeaklet_classification
) and several neutron veto cut plugins in cutax (all producecut_coincident_events_nv
as well as another datatype that varies per plugin).