MCPcopy Index your code
hub / github.com/python/cpython / _finalize_manager

Method _finalize_manager

Lib/multiprocessing/managers.py:663–695  ·  view source on GitHub ↗

Shutdown the manager process; will be registered as a finalizer

(process, address, authkey, state, _Client,
                          shutdown_timeout)

Source from the content-addressed store, hash-verified

661
662 @staticmethod
663 def _finalize_manager(process, address, authkey, state, _Client,
664 shutdown_timeout):
665 '''
666 Shutdown the manager process; will be registered as a finalizer
667 '''
668 if process.is_alive():
669 util.info('sending shutdown message to manager')
670 try:
671 conn = _Client(address, authkey=authkey)
672 try:
673 dispatch(conn, None, 'shutdown')
674 finally:
675 conn.close()
676 except Exception:
677 pass
678
679 process.join(timeout=shutdown_timeout)
680 if process.is_alive():
681 util.info('manager still alive')
682 if hasattr(process, 'terminate'):
683 util.info('trying to `terminate()` manager process')
684 process.terminate()
685 process.join(timeout=shutdown_timeout)
686 if process.is_alive():
687 util.info('manager still alive after terminate')
688 process.kill()
689 process.join()
690
691 state.value = State.SHUTDOWN
692 try:
693 del BaseProxy._address_to_local[address]
694 except KeyError:
695 pass
696
697 @property
698 def address(self):

Callers

nothing calls this directly

Calls 7

dispatchFunction · 0.70
is_aliveMethod · 0.45
infoMethod · 0.45
closeMethod · 0.45
joinMethod · 0.45
terminateMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected