tigerneil / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

Get process parent #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As a new feature, it would be nice to get the process parent as a psutil class.

Example:

>>> parent = psutil.parent(os.getpid())
>>> parent.pid
11038
>>> parentPID = psutil.Process(11038).parent.pid
>>> parentPID
1

Thank you.

Original issue reported on code.google.com by l.vbo...@gmail.com on 16 Feb 2009 at 10:02

GoogleCodeExporter commented 9 years ago
I should clarify that this issue is not a defect, as automatically classified by
Google, but I didn't know how to post an "enhancement".

Original comment by l.vbo...@gmail.com on 16 Feb 2009 at 10:06

GoogleCodeExporter commented 9 years ago
I think that a more convenient API would be:

>>> parent = psutil.Process(11038).parent  # the parent pid
>>> parent
1

...so that if you want to do something useful with the parent process you just
instantiate a new Process class:

>>> psutil.Process(parent)
<psutil.Process object at 0x00A87F70>

I'm gonna add this task in the roadmap.

Original comment by billiej...@gmail.com on 16 Feb 2009 at 10:23

GoogleCodeExporter commented 9 years ago
Implemented for Linux and OS X as r103 - Windows platform to follow after I've 
had a
chance to research how to implement it and do some testing. For now Windows will
always return None for ppid. 

Original comment by jlo...@gmail.com on 17 Feb 2009 at 1:22

GoogleCodeExporter commented 9 years ago
Note: implemented as a "ppid" property currently, rather than "parent", to fit 
with
the traditional ps command's abbreviation.

Original comment by jlo...@gmail.com on 17 Feb 2009 at 1:24

GoogleCodeExporter commented 9 years ago
Now implemented on Win32 also as r105

Original comment by jlo...@gmail.com on 17 Feb 2009 at 2:38

GoogleCodeExporter commented 9 years ago
After some additional discussion, r109 now implements a "parent" property that
returns a Process object for the parent process.

Original comment by jlo...@gmail.com on 17 Feb 2009 at 4:34

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 18 Feb 2009 at 2:43

GoogleCodeExporter commented 9 years ago
Well, guys, thanks for the quick response. It's really a pleasure to give 
feedback to
a group so commited as yours.
I'm now giving my firsts steps to upload my own Python projects into Google 
Code.

Original comment by l.vbo...@gmail.com on 18 Feb 2009 at 3:10

GoogleCodeExporter commented 9 years ago
You're more than welcome, after all we created the library to be used so it's 
great
to see feedback. Congratulations on being our first user to request an 
enhancement :-)

Original comment by jlo...@gmail.com on 18 Feb 2009 at 3:33

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 23 Feb 2009 at 5:49

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 17 Mar 2009 at 3:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r103 == revision 1274a5569547
r105 == revision 53f7761c6110
r109 == revision 1cf29dac01e7

Original comment by g.rodola on 2 Mar 2013 at 11:39