Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Feature wait for sentinel #5

Draft
wants to merge 2 commits into
base: paperless-main
Choose a base branch
from

Conversation

stumpylog
Copy link
Member

Previous Architecture

Then sentinel guard loop constantly looped, checking if the processes were still alive or needed to be recycled, before sleeping a short period and starting the loop over again.

New Architecture

Every Python Process object has a sentinel field associated with it, which multiprocessing.connection.wait can block on. This call returns when the sentinel is "ready", which for a process means the process has ended (either through death or finishing work to be recycled).

Using this, the cluster sentinel can wait for any of the objects to end and deal with the ending on an as needed basis, rather than polling for changes in process status.

Considerations

Needs #2 merged first, then the guard loop can be cleaned up further, removing the sleep portion entirely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant