Allow CallsiteParameterAdder to be pickled - #603
Conversation
Prior to this commit, the `CallsiteParameterAdder` object could not be pickled. As a result, structlog configurations could not be propagated to subprocesses using `pickle.dumps(structlog.get_config())`. This commit updates the handlers in `CallsiteParameterAdder._handlers` to be free functions, rather than lambda functions, so that all class members can be pickled. Closes hynek#600
for more information, see https://pre-commit.ci
Required for compatibility with TVM PR apache/tvm#16618. Can be removed after upstream `structlog` hynek/structlog#603 lands. This is a backport of the OLLM PR https://github.com/octoml/ollm/pull/409, and is not needed after the MLC-serve migration.
Required for compatibility with TVM PR apache/tvm#16618. Can be removed after upstream `structlog` hynek/structlog#603 lands. This is a backport of the OLLM PR https://github.com/octoml/ollm/pull/409, and is not needed after the MLC-serve migration.
There was a problem hiding this comment.
Can you make the function names verbs please? (iow: _pathname → _get_pathname).
Changelog entry would be great too ("structlog.processors.CallsiteParameterAdder is now pickleable." + link here).
(oh and get the CI green too, pls 😇 – I think it's just missing type hints for the functions?)
Can do. I've updated each function name from
And updated. (Made the commit for the changelog yesterday, but forgot to push it.)
Thank you on pointing me in the right direction. Updated the signatures from |
Summary
Prior to this commit, the
CallsiteParameterAdderobject could not be pickled. As a result, structlog configurations could not be propagated to subprocesses usingpickle.dumps(structlog.get_config()). This commit updates the handlers inCallsiteParameterAdder._handlersto be free functions, rather than lambda functions, so that all class members can be pickled.Closes #600
Pull Request Check List
mainbranch – use a separate branch!api.py.docs/api.rstby hand.versionadded,versionchanged, ordeprecateddirectives..rstand.mdfiles is written using semantic newlines.