Issue10784
Created on 2010-12-28 01:46 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| getsetpriority.patch | giampaolo.rodola, 2010-12-28 01:47 | |||
| Messages (12) | |||
|---|---|---|---|
| msg124751 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2010-12-28 01:46 | |
After having implemented a similar thing in psutil ( http://code.google.com/p/psutil/issues/detail?id=142 ) I decided to contribute a patch for Python which exposes getpriority() and setpriority() POSIX calls in the os module. They can be used to get/set process niceness/priority in a fashion similar to os.nice() but extended to *all* processes instead of just os.getpid(): http://linux.die.net/man/2/setpriority |
|||
| msg124752 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2010-12-28 01:47 | |
Forgot to attach the patch. |
|||
| msg124763 - (view) | Author: Ross Lagerwall (rosslagerwall) ![]() |
Date: 2010-12-28 05:36 | |
Patch looks good, just one thing: In setpriority(), it should be possible to use the Py_RETURN_NONE; macro instead of INCREFing manually. |
|||
| msg124778 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2010-12-28 10:18 | |
Looks good. Would there be a point in making any of the parameters optional? |
|||
| msg124780 - (view) | Author: Martin v. Löwis (loewis) * ![]() |
Date: 2010-12-28 10:32 | |
> Looks good. Would there be a point in making any of the parameters optional? No. The API should look exactly as it does on the system level. Anybody calling these functions should know how call them. |
|||
| msg125887 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2011-01-10 09:44 | |
Question: should Py_BEGIN/END_ALLOW_THREADS be used around getpriority() and setpriority() calls? It's still not clear to me when to use them exactly. |
|||
| msg125908 - (view) | Author: Martin v. Löwis (loewis) * ![]() |
Date: 2011-01-10 17:55 | |
You should use begin/end allow threads when the system call might block. To get an indication, trace through the kernel code of some system; my guess is that these are typically non-blocking (i.e. return immediately) - but I might be wrong. |
|||
| msg129426 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2011-02-25 20:58 | |
Committed in r88608 including Py_RETURN_NONE and Py_BEGIN/END_ALLOW_THREADS changes. |
|||
| msg129427 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2011-02-25 21:00 | |
Misc/NEWS updated in r88609. |
|||
| msg129474 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2011-02-26 00:11 | |
====================================================================== ERROR: test_set_get_priority (test.test_os.ProgramPriorityTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_os.py", line 1283, in test_set_get_priority os.setpriority(os.PRIO_PROCESS, os.getpid(), base) OSError: [Errno 13] Permission denied During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_os.py", line 1285, in test_set_get_priority if err.errno != errno.EACCESS: AttributeError: 'module' object has no attribute 'EACCESS' |
|||
| msg129501 - (view) | Author: Senthil Kumaran (orsenthil) * ![]() |
Date: 2011-02-26 06:34 | |
On Sat, Feb 26, 2011 at 12:11:10AM +0000, Antoine Pitrou wrote: > if err.errno != errno.EACCESS: > AttributeError: 'module' object has no attribute 'EACCESS' That was one 'S' too many. Should be errno.EACCES Looks like Antoine has fixed it in r88627. |
|||
| msg129504 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2011-02-26 06:40 | |
Indeed. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:10 | admin | set | github: 54993 |
| 2011-02-26 06:40:26 | pitrou | set | status: open -> closed nosy: loewis, georg.brandl, orsenthil, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall messages: + msg129504 |
| 2011-02-26 06:34:39 | orsenthil | set | nosy:
+ orsenthil messages: + msg129501 |
| 2011-02-26 00:11:08 | pitrou | set | status: closed -> open nosy: loewis, georg.brandl, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall messages: + msg129474 |
| 2011-02-25 21:00:27 | giampaolo.rodola | set | nosy:
loewis, georg.brandl, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall messages: + msg129427 |
| 2011-02-25 20:58:43 | giampaolo.rodola | set | status: open -> closed messages:
+ msg129426 |
| 2011-01-10 20:02:45 | pitrou | set | nosy:
loewis, georg.brandl, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall stage: patch review |
| 2011-01-10 17:55:27 | loewis | set | nosy:
loewis, georg.brandl, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall messages: + msg125908 |
| 2011-01-10 09:44:30 | giampaolo.rodola | set | nosy:
loewis, georg.brandl, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall messages: + msg125887 |
| 2010-12-28 10:32:04 | loewis | set | nosy:
loewis, georg.brandl, pitrou, giampaolo.rodola, christian.heimes, rosslagerwall messages: + msg124780 |
| 2010-12-28 10:18:26 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg124778 |
| 2010-12-28 05:36:19 | rosslagerwall | set | nosy:
+ rosslagerwall messages: + msg124763 components:
+ Extension Modules |
| 2010-12-28 02:04:50 | giampaolo.rodola | set | nosy:
+ christian.heimes |
| 2010-12-28 01:47:08 | giampaolo.rodola | set | files:
+ getsetpriority.patch nosy: loewis, pitrou, giampaolo.rodola messages: + msg124752 |
| 2010-12-28 01:46:49 | giampaolo.rodola | create | |
