-
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
only use roman.meta for get_crds_parameters #372
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #372 +/- ##
==========================================
+ Coverage 97.56% 97.77% +0.21%
==========================================
Files 30 36 +6
Lines 2788 3369 +581
==========================================
+ Hits 2720 3294 +574
- Misses 68 75 +7 ☔ View full report in Codecov by Sentry. |
775c777
to
56b2ee9
Compare
This comment was marked as outdated.
This comment was marked as outdated.
f3f8ea0
to
c59254c
Compare
c59254c
to
e474895
Compare
Sorry that it's been a while since you filed this.
Just making sure I follow, you're saying that you could ask CRDS to say what it needs, and then send it back exactly that, rather than just sending the entire meta contents minus the arrays. I hear you and agree that we shouldn't need to do that and your PR is good as is. |
fa04672
to
6f5e540
Compare
6f5e540
to
d29955c
Compare
Closes #367
Closes #366
This PR modifies
DataModel.get_crds_parameters
to only include (and only access) items underroman.meta
.get_crds_parameters
is called twice during the setup of commands like the followingstrun MyStep mydata.asdf
. Once to get the pars file for theMyStep
and again to prefetch reference files formydata.asdf
. Each of these calls will:Datamodel
contains inmydata.asdf
(each call separately opens the file, the opened datamodel is not shared between calls)Datamodel.get_crds_parameters
With the current implementation of
get_crds_parameters
, every attribute of the datamodel is accessed and then the attributes are filtered to include select non-array values (see the code for the specific filtering). For a "lazy" file this will result in loading and converting all contents of the file twice before the file is again re-opened withinMyStep.process
.With this PR only the nodes under
roman.meta
are accessed and included forget_crds_parameters
. This PR does not query crds for the required parameter selectors (parkeys) as:Querying crds would allow fewer metadata entries to be loaded (which is a very minor improvement that might be offset by the crds API) and would protect against the unlikely case that a non-
roman.meta
attribute is used as a selector.This PR also fixes the "include_arrays" filtering for
DataModel.to_flat_dict
.Regression tests: https://github.com/spacetelescope/RegressionTests/actions/runs/10268370867
show unrelated failures due to background changes.
Checklist
CHANGES.rst
under the corresponding subsection