3

I am using Manager in python multiprocessing, Since a manager started , a subprocess is spawned, How can I get the pid of the subprocess? THX

user1221244
  • 289
  • 4
  • 12

1 Answers1

1

Too late an answer for user1221244, but something that could help future readers of this thread:

As of PY361, the PID of the Manager() instance could possibly be obtained as demoed in the code below:

import multiprocessing;
if __name__ == '__main__':
    Mngr = multiprocessing.Manager();
    print('Manager process Pid:', Mngr._process.ident);

Note though that because the above involves access to a object marked as private (_process), it might change in future releases.

Snidhi Sofpro
  • 479
  • 7
  • 10