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


Groups > comp.lang.python > #44565

Re: python process accounting

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <g.rodola@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.028
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'exec': 0.09; 'facts': 0.09; 'skip:/ 10': 0.09; 'subject:process': 0.09; 'wrapper': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'processes.': 0.16; 'subject:python': 0.16; 'seems': 0.21; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; '---': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'first,': 0.26; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'url:code': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'info.': 0.31; 'run': 0.32; 'open': 0.33; 'url:python': 0.33; 'running': 0.33; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'possible': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'so,': 0.37; 'expect': 0.39; 'sure': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; "you're": 0.61; 'such': 0.63; 'url:p': 0.64; 'management': 0.65; 'account': 0.65; 'talking': 0.65; 'to:addr:gmail.com': 0.65; 'rita': 0.84; 'snapshot': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=TBixKUidgt+9A8IRSif66Y81BwZvlf3m/aGh/7J13Ks=; b=JOVcMVT1sX8Z1NuEkdfWLN4gfpmO4XztgrAiSbTABAe4ct244WdYeO/IYZOdo8IUXm ggkwQ45HdbU4yzX5pm2oGVGSUH/RshKVYsnTxOo+d3CWwqle85b7MyaFTpYoeJCLRzll bVgTRx681VhbGKI2NNcbh4EhWcIE9uMKjYYrz+iblShWWYLFAedVkFibmhP3UOB9IIST KLQjytjPqkJzRiuYp9QbSVn40JMKIxTJhppxfFuXikGt1ZVJc3c8IrqA5zt7rKB7xrui jm9qPnflGtTjkY4g9ah2fEhAPz+qDPz7Rnb6WLwgmfYouIZp0JmYUrOWO/fb0UC+f+P2 vKsw==
X-Received by 10.112.219.197 with SMTP id pq5mr29082959lbc.102.1367342356671; Tue, 30 Apr 2013 10:19:16 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAOF-KfhSkQrRPjiyN3bkLwCguFw58Pzf-nu1ne9ZoZDQw3t6SQ@mail.gmail.com>
References <CAOF-KfhSkQrRPjiyN3bkLwCguFw58Pzf-nu1ne9ZoZDQw3t6SQ@mail.gmail.com>
From "Giampaolo Rodola'" <g.rodola@gmail.com>
Date Tue, 30 Apr 2013 19:18:56 +0200
Subject Re: python process accounting
To Rita <rmorgan466@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1196.1367346202.3114.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367346202 news.xs4all.nl 15986 [2001:888:2000:d::a6]:56807
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44565

Show key headers only | 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