idaholab / raven

RAVEN is a flexible and multi-purpose probabilistic risk analysis, validation and uncertainty quantification, parameter optimization, model reduction and data knowledge-discovering framework.
https://raven.inl.gov/
Apache License 2.0
216 stars 132 forks source link

Removes writeTo option for message in MessageHandler #2256

Closed j-bryan closed 6 months ago

j-bryan commented 6 months ago

Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

Closes #2255

What are the significant changes in functionality due to this change request?

When using ravenframework as a Python module, users are able to overwrite sys.stdout with another destination, and this is now honored by RAVEN. This was accomplished by simply removing the writeTo option from MessageHandler.message().

Before settling on removing the option, I also tried to track the argument as an instance variable instead (self._writeTo). However, this approach was rejected for two major reasons. First, storing sys.stdout or a file object from using the open() function as an attribute led to problems pickling the class. While these two cases are simple enough to handle, if the user has supplied their own class for writeTo, it will be impossible to correctly reinstantiate the class upon unpickling. I felt this was then better left to the user to handle outside of RAVEN.


For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.