AxFoundation/strax

show_config messes with plugin registry!

Closed this issue ยท 5 comments

Describe the bug
Somehow show config messes with the plugin registry such that st._get_plugins returns a wrong set of plugins. This is a pretty big bug.

MWE:

st._get_plugins(('records'), '0')  # normal return
st.show_config('event_info')
st._get_plugins(('records'), '0')  # Returns all plugins needed for event info instead of records...

Nice catch, looks like the Context._get_plugins method ignores the targets when they are all found in the plugin cache and just returns all of the plugins given by Context.__get_plugins_from_cache here

The issue was actually introduced with the plugins caching in: #483

MWE:

st._get_plugins(('records',), '0')
st._get_plugins(('peaklets',), '0')
st._get_plugins(('records',), '0')

@jmosbacher yes, I am quite surprised that this did not lead to any bigger issues in the processing to be honest.

I guess the places where it is used either select a specific plugin from the dict (like the key_for etc.) or further extract only the plugins based on what needs to be reprocessed (get_components) since some data can already exist.
The only effect is probably a small performance hit because the get_components will call Plugin.setup on all the plugins before they are filtered out.

Looks like an easy fix, are you already working on a PR or should I make one?

Yes I also checked get_components, we are looping over all provided plugins and only take the required ones.

I am working already on it thanks.