Add process pool initializer to manage-imports script - #12900
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes importbot restart loop under Python 3.14+ by ensuring child processes started via multiprocessing (now defaulting to spawn on Linux per PR description) load the Open Library config before running import work.
Changes:
- Add a
multiprocessing.Poolworker initializer that callsload_config(configfile)in each spawned process. - Thread the resolved
configfilepath through CLI flags intoimport_all()so the pool initializer can use it.
jimchamp
commented
Jun 11, 2026
Member
|
Thank you!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes bug causing the
importbotcontainer to restart endlessly.Prior to Python 14, the default
multiprocessingstart method in Linux environments wasfork. Now,spawnis the default.spawncreates a new Python interpreter process, which does not inherit the parent process'sweb.config. Theweb.configin spawned processes did not contain the necessary credentials for connecting to our DB, causing an unhandled error which stopped the container.This code creates an initializer method which calls
load_configwhen a new process is spawned. Now, new processes contain the necessary credentials, and the container no longer restarts ceaselessly.Technical
Testing
Screenshot
Stakeholders