Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44565 > unrolled thread

Re: python process accounting

Started by"Giampaolo Rodola'" <g.rodola@gmail.com>
First post2013-04-30 19:18 +0200
Last post2013-04-30 19:18 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python process accounting "Giampaolo Rodola'" <g.rodola@gmail.com> - 2013-04-30 19:18 +0200

#44565 — Re: python process accounting

From"Giampaolo Rodola'" <g.rodola@gmail.com>
Date2013-04-30 19:18 +0200
SubjectRe: python process accounting
Message-ID<mailman.1196.1367346202.3114.python-list@python.org>
2013/4/30 Rita <rmorgan466@gmail.com>:
> Hi,
>
> I was wondering if it possible to write a python wrapper which will account
> my processes. I would like to account for all the children processes (fork)
> by looking at their /proc/<pid> info. Such as memory, io, open files, stats.
>
> So, instead of me running "/bin/sleep 10", i would like to run it as
> "pywrap.py /bin/sleep 10" and it will do an exec /bin/sleep 10 and do a
> periodic snapshot for whats in /proc/<pid>/stats.
>
>
>
>
> --
> --- Get your facts first, then you can distort them as you please.--
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Not sure what you're talking about expect for the process management
part in which case it seems you're looking for psutil:
https://code.google.com/p/psutil/#Process_management
In detail, if you want to work with process children:

>>> import psutil, os
>>> thisproc = psutil.Process(os.getpid())
>>> for child in thisproc.get_children():
...          print child.name
...          print child.get_memory_info()
...          print child.get_open_files()
...

--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web