-
Notifications
You must be signed in to change notification settings - Fork 38
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 not add producer that has been added by saver #901
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dachengx
commented
Oct 13, 2024
@@ -1006,7 +1006,7 @@ def _get_end_targets(plugins: dict) -> ty.Tuple[str]: | |||
"""Get the datatype that is provided by a plugin but not depended on by any other plugin.""" | |||
provides = [prov for p in plugins.values() for prov in strax.to_str_tuple(p.provides)] | |||
depends_on = [dep for p in plugins.values() for dep in strax.to_str_tuple(p.depends_on)] | |||
uniques = list(set(provides) ^ set(depends_on)) | |||
uniques = list(set(provides) - set(depends_on)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of dependencies, do not keep used dependencies.
dachengx
commented
Oct 13, 2024
self.post_office.register_producer( | ||
p.iter(iters={dep: self.post_office.get_iter(dep, d) for dep in p.depends_on}), | ||
topic=strax.to_str_tuple(p.provides), | ||
registered=tuple(components.loaders), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core of this PR: do not register loaders
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This is to solve the error when
processor = "single_thread"
in #903.In the example of #903, after
st.make(nt_test_run_id, "peaklets", processor="single_thread")
, thepulse_counts
is saved. So the loader will load this plugin becausepeaklets
needrecords
andpulse_counts
are produced along withrecords
. Sopulse_counts
is incomponents.loaders
.But before this PR, since
records
is also incomponents.plugins
,strax/strax/processors/single_thread.py
Line 38 in dca3545
pulse_counts
in the producer so this caused the bug.Can you briefly describe how it works?
This PR prevents the producer registration if a
data_type
is already incomponents.loaders
.Can you give a minimal working example (or illustrate with a figure)?
Please check #903.
Please make sure that all automated tests have passed before asking for a review (you can save the PR as a draft otherwise).