Closed GoogleCodeExporter closed 9 years ago
and now with the diff attached :)
Original comment by dolfandr...@gmail.com
on 19 Jan 2012 at 10:39
Attachments:
> patch in attachment adds a get_lowest_descendants()
> method on the Process object, which fetches all
> descendants from a process, that don't have
> child processes themselves.
Mmm interesting.
I think I don't have a clear mind about this yet.
At first it seems kind of useful, on the other hand I'm not sure about its
reliability.
Imagine this:
process A creates process B which creates process C
In normal circumstances your method would return A, B and C, but if B gets
terminated in meantime you're gonna lose the reference to C and get only A in
return.
Other than that, I think this would be better served by adding an extra
argument to get_children() method:
>>> get_children(recursive=True)
...and make it return only B and C but not itself (A).
Also, it seems natural to make get_children() return an iterator rather than a
list.
The same should be done for get_open_files(), get_connections() and
get_threads() (I'll file a new ticket for that).
Jay, what do you think?
Original comment by g.rodola
on 19 Jan 2012 at 1:33
In your example where process A creates process B which creates process C,
the code would only return process C, not B, since B has children.
Another option for my use case would then be
>>> filter(lambda x: len(x.children)==0,get_children(recursive=True))
Original comment by dolfandr...@gmail.com
on 19 Jan 2012 at 2:07
This is now implemented in r1282.
Please look at the docstring and let me know if with this you're able to cover
your use case.
Original comment by g.rodola
on 7 Apr 2012 at 3:38
Change recursion algorithm as r1283.
Original comment by g.rodola
on 8 Apr 2012 at 12:37
Original comment by g.rodola
on 12 Apr 2012 at 6:15
0.5.0 is finally out. Closing out as fixed.
Original comment by g.rodola
on 27 Jun 2012 at 6:54
[deleted comment]
Updated csets after the SVN -> Mercurial migration:
r1282 == revision 19893ece7eff
r1283 == revision 0e9fabea61e2
Original comment by g.rodola
on 2 Mar 2013 at 12:06
Original issue reported on code.google.com by
dolfandr...@gmail.com
on 19 Jan 2012 at 10:39