Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30098
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dpalao.python@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.05; 'subject:How': 0.09; 'python': 0.09; 'received:141': 0.13; '(ubuntu': 0.16; 'escribi\xf3:': 0.16; 'subject:limit': 0.16; 'subject:usage': 0.16; 'processor': 0.17; 'typical': 0.17; 'solution.': 0.18; 'module': 0.19; 'all,': 0.21; 'import': 0.21; 'cc:2**0': 0.23; 'tools,': 0.23; 'external': 0.24; 'linux': 0.24; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'related': 0.30; 'to:addr:python-list': 0.33; 'sometimes': 0.35; 'there': 0.35; 'but': 0.36; 'useful': 0.36; 'possible': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'think': 0.40; 'limit': 0.65; 'regards.': 0.66; 'lose': 0.71; 'saw': 0.75; 'few.': 0.93 |
| From | DPalao <dpalao.python@gmail.com> |
| To | python-list@python.org |
| Subject | Re: How to limit CPU usage in Python |
| Date | Tue, 25 Sep 2012 17:07:07 +0200 |
| User-Agent | KMail/4.8.5 (Linux/3.2.12-gentoo; KDE/4.8.5; x86_64; ; ) |
| In-Reply-To | <505B326C.1060503@cnic.edu.cu> |
| References | <505B326C.1060503@cnic.edu.cu> |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | quoted-printable |
| Content-Type | text/plain; charset="iso-8859-1" |
| 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.1345.1348586032.27098.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348586033 news.xs4all.nl 6894 [2001:888:2000:d::a6]:58118 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30098 |
Show key headers only | View raw
On Jueves septiembre 20 2012 11:12:44 Rolando Cañer Roblejo escribió: > Hi all, > > Is it possible for me to put a limit in the amount of processor usage (% > CPU) that my current python script is using? Is there any module useful > for this task? I saw Resource module but I think it is not the module I > am looking for. Some people recommend to use nice and cpulimit unix > tools, but those are external to python and I prefer a python solution. > I am working with Linux (Ubuntu 10.04). > > Best regards. Hola, Sometimes a stupid solution like the following does the trick: > import time > for t in tasks: > do_something(t) > time.sleep(some_seconds) where "some_seconds" is a number related to the typical time-scale of the tasks you are doing. Hope it helps, Regards -- Miller's Slogan: Lose a few, lose a few.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: How to limit CPU usage in Python DPalao <dpalao.python@gmail.com> - 2012-09-25 17:07 +0200 Re: How to limit CPU usage in Python 88888 Dihedral <dihedral88888@googlemail.com> - 2012-09-25 15:39 -0700 Re: How to limit CPU usage in Python 88888 Dihedral <dihedral88888@googlemail.com> - 2012-09-25 15:39 -0700
csiph-web