-
Notifications
You must be signed in to change notification settings - Fork 21
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 copy datamodels when opening an already open datamodel. #232
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #232 +/- ##
==========================================
+ Coverage 96.74% 96.88% +0.13%
==========================================
Files 28 29 +1
Lines 2399 2406 +7
==========================================
+ Hits 2321 2331 +10
+ Misses 78 75 -3
☔ View full report in Codecov by Sentry. |
We should be a bit careful here, the changes currently fail this check: roman_datamodels/tests/test_open.py Lines 98 to 100 in ce423ee
The note is absolutely correct, in that if we don't do the copy being removed, then calling Currently, we are a bit caviler about sometimes calling close and sometimes not calling
In effect this means we cannot guarantee that our models will be properly cleaned up by These two issues are both solved by the copy being removed here because it disconnects models "opened" during a given step from models passed in. So we both never accidentally close a model we need open, and can properly close the files for models when needed. I personally agree with the changes here as it is silly to copy things for no real reason. However, we need to approach this very carefully or otherwise we might cause ourselves very difficult to solve bugs. |
Yes. The way I think of this, if we open a file, we're responsible for cleaning it up. If we accept an object, the person who made the object is responsible for cleaning it up (or we wait for it to be garbage collected). The current pipeline practice of using Maybe a better solution would be for |
…amodels into reduce-copies
8cc322e
to
476848b
Compare
I think this is ready for review. This changes the behavior of rdm.open(...) to return a shallow rather than full copy. rdm.open(...) is used throughout romancal and stcal to open already opened data models, and the previous behavior of making copies for this purpose wasted a lot of memory. This has some implications in terms of what we're allowed to return from the pipeline, which leads to me making lazy_loading the default in the romancal pipeline. That's discussed in more detail in the related romancal PR here: spacetelescope/romancal#774 |
Can you add a plwishmaster link (presumably with the RCAL-774 ticket) to show this passing regression tests? |
romancal regression tests with this PR here: https://plwishmaster.stsci.edu:8081/job/RT/job/Roman-Developers-Pull-Requests/281/ |
(and note that I don't remember but that I don't think regression tests on romancal would pass with only this PR. One needs the other work on romancal too.) |
I'm confused, what other romancal work does the memory work depend on?
Are you saying that the steps don't run with these changes?
…On 7/14/23 8:56 PM, Eddie Schlafly wrote:
(and note that I don't remember but that I don't think regression
tests on romancal would pass with /only/ this PR. One needs the other
work on romancal too.)
—
Reply to this email directly, view it on GitHub
<https://urldefense.com/v3/__https://github.com/spacetelescope/roman_datamodels/pull/232*issuecomment-1636597248__;Iw!!CrWY41Z8OgsX0i-WU-0LuAcUu2o!zMLH15idQb4luRN53nt2X1bYVWQSva2rLSzygvpNuFEgrWHUQW5Ovgu175XySVqCd8skqi05FesMuV9IkjPuvNRr$>,
or unsubscribe
<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ALXCXWLCWZETG3HP22FFBPTXQHTEPANCNFSM6AAAAAAZ7PD5RQ__;!!CrWY41Z8OgsX0i-WU-0LuAcUu2o!zMLH15idQb4luRN53nt2X1bYVWQSva2rLSzygvpNuFEgrWHUQW5Ovgu175XySVqCd8skqi05FesMuV9IkoLRt1O7$>.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
I have two PRs. This one on roman_datamodels and spacetelescope/romancal#774 on romancal. Both are required. I was worried by Paul's questions that I had missed some roman_datamodels specific regression tests, but it looks like there are only the romancal regression tests, for which I have linked a run here: |
I did this in |
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
Merged in updates from main, reran regression tests; merging. |
This PR starts to try to reduce memory usage in romancal by changing the default behavior of rdm.open(datamodel) to just return the existing datamodel rather than to make a copy. This likely has important downstream consequences that I haven't fully sussed out, though!