-
Notifications
You must be signed in to change notification settings - Fork 136
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
Fix bug where custom environment plugins were lost on dataset merge #1582
Fix bug where custom environment plugins were lost on dataset merge #1582
Conversation
Fixes crash where before the names of the plugins were passed instead
This fixes a bug where the default environment was always returned on merge
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1582 +/- ##
===========================================
+ Coverage 81.04% 81.06% +0.02%
===========================================
Files 278 278
Lines 32490 32490
Branches 6600 6599 -1
===========================================
+ Hits 26330 26339 +9
+ Misses 4706 4698 -8
+ Partials 1454 1453 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thank you for your interest to our project! Could you add an unit test for this?
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.
LGTM. Thanks for your interest into our projects.
…penvinotoolkit#1582) I ran into an issue where plugins loaded into the `Environment` are not retained after merging. Turns out a generator is being passed to [Environment.merge](https://github.com/openvinotoolkit/datumaro/blob/30b1add52d6fe458dba5e32e1f63ffeea999ad7b/src/datumaro/components/environment.py#L271) instead of the expected Sequence. This meant that custom plugins were never registered into the merged environment. Reproducible example: ```python from datumaro.components.dataset import Dataset from datumaro.components.environment import Environment from datumaro.components.exporter import Exporter from datumaro.components.hl_ops import HLOps from datumaro.components.media import Image class MyPlugin(Exporter): pass environment = Environment() environment.exporters.register('my_plugin', MyPlugin) dataset1 = Dataset(media_type=Image, env=environment) datasets = [dataset1, dataset1.clone()] merged = HLOps.merge(*datasets) assert 'my_plugin' in dataset1.env.exporters # Passes assert 'my_plugin' in merged.env.exporters # Fails ``` --------- Co-authored-by: Sooah Lee <[email protected]>
Summary
I ran into an issue where plugins loaded into the
Environment
are not retained after merging. Turns out a generator is being passed to Environment.merge instead of the expected Sequence. This meant that custom plugins were never registered into the merged environment.How to test
Reproducible example:
Checklist
License
Feel free to contact the maintainers if that's a concern.