-
Notifications
You must be signed in to change notification settings - Fork 137
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
load CocoPageMapper once per process #1184
load CocoPageMapper once per process #1184
Conversation
try: | ||
from datumaro.rust_api import CocoPageMapper as CocoPageMapperImpl | ||
except ImportError: | ||
pass |
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.
What is the exact case requiring this fix? If any interpreter goes into L10-11, it means that it doesn't loads CocoPageMapperImpl
just a once but does not load CocoPageMapperImpl
totally.
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.
The error occurs when importing a dataset multiple times in the streamlit GUI.
I thought this problem can be reproduced easily in the normal interpreter, but it was not.
I guess I need to handle this problem in another way.
So, I'll cancel this change at the moment.
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.
What Python version is in your dev env? 3.12?
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.
My Python version is 3.10.
Anyway, it's strange that I cannot reproduce this problem after reverting the code.
I'll revisit this issue once it is reproduced.
I might have made a mistake when dealing with the streamlit.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## releases/1.5.0 #1184 +/- ##
==================================================
- Coverage 79.96% 79.96% -0.01%
==================================================
Files 265 265
Lines 29705 29708 +3
Branches 5831 5831
==================================================
+ Hits 23755 23756 +1
- Misses 4618 4620 +2
Partials 1332 1332
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Summary
When loading CocoPageMapper multiple times per interpreter or process, it would raise an ImportError as shown below.
So, I have modified it to import the module only once.
How to test
Checklist
License
Feel free to contact the maintainers if that's a concern.