spacetelescope / stpipe

https://stpipe.readthedocs.io
Other
3 stars 25 forks source link

stpipe `_log_records` links input model lifetime to step #169

Closed braingram closed 1 month ago

braingram commented 1 month ago

From some debugging with @tapastro we found that: https://github.com/spacetelescope/stpipe/blob/9952c365458fc3f01839a912b62ab6c637dc9179/src/stpipe/step.py#L429

creates a LogRecord entry that retains a reference to the input arguments. In the case of a step running where the input is a DataModel this means the LogRecord will prevent the DataModel from being garbage collected.

As all LogRecords are assigned to Step._log_records this links the records to the Step instance so that all logs persist until the step is garbage collected.