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


Groups > comp.lang.python > #44565

Re: python process accounting

References <CAOF-KfhSkQrRPjiyN3bkLwCguFw58Pzf-nu1ne9ZoZDQw3t6SQ@mail.gmail.com>
From "Giampaolo Rodola'" <g.rodola@gmail.com>
Date 2013-04-30 19:18 +0200
Subject Re: python process accounting
Newsgroups comp.lang.python
Message-ID <mailman.1196.1367346202.3114.python-list@python.org> (permalink)

Show all headers | View raw


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/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web