|
assert diff.identical, diff.report() |
is a common pattern for regression tests. By default pytest will rewrite this assert to capture additional information about the failure (beyond the
AssertionError and message). This includes capturing a reference to the
diff instance that lives throughout the duration of the test session. Since
diff contains references to the input files (and other objects, note that this is not specific to stfitsdiff and also applies to astropy fitsdiff):
|
if len(self.a) != len(self.b): |
this likely contributed to the recent termination of regtest runs where:
- many failures were introduced by a context change
- these failures caused pytest to hold only large amounts of memory
- memory usage exceeded that available on the worker node
- worker node terminated before information about failures were reported
There are a few options for addressing this including:
- disabling pytest assertion rewriting. This would have minimal or no impact on asserts like the above but would produce less useful information for other asserts.
- modify fitsdiff to not hold so many references.
Taking the above example:
|
diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs) |
|
assert diff.identical, diff.report() |
fitsdiff could be modified to compute
identical and
report and release all references to data arrays, input files, etc. This approach would be complicated by other fitsdiff usage (that doesn't just access
identical and
report) so perhaps this pre-computation and reference release might make sense to capture in some regtest-specific code. Something like:
def assert_output_matches_truth(output, truth, **kwargs):
diff = FITSDiff(rtdata.output, rtdata.truth, **fitsdiff_default_kwargs)
identical = diff.identical
report = diff.report()
del diff # not sure if this is 100% needed
assert identical, report
jwst/jwst/regtest/test_niriss_wfss.py
Line 86 in 7c16638
is a common pattern for regression tests. By default pytest will rewrite this assert to capture additional information about the failure (beyond the
AssertionErrorand message). This includes capturing a reference to thediffinstance that lives throughout the duration of the test session. Sincediffcontains references to the input files (and other objects, note that this is not specific to stfitsdiff and also applies to astropy fitsdiff):jwst/jwst/regtest/st_fitsdiff.py
Line 190 in 7c16638
this likely contributed to the recent termination of regtest runs where:
There are a few options for addressing this including:
Taking the above example:
jwst/jwst/regtest/test_niriss_wfss.py
Lines 85 to 86 in 7c16638
fitsdiff could be modified to compute
identicalandreportand release all references to data arrays, input files, etc. This approach would be complicated by other fitsdiff usage (that doesn't just accessidenticalandreport) so perhaps this pre-computation and reference release might make sense to capture in some regtest-specific code. Something like: