Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting affinity for spawned processes #291

Closed
giampaolo opened this issue May 23, 2014 · 3 comments
Closed

Setting affinity for spawned processes #291

giampaolo opened this issue May 23, 2014 · 3 comments

Comments

@giampaolo
Copy link
Owner

From maciej.l...@gmail.com on June 28, 2012 15:31:05

What steps will reproduce the problem?  
1. import psutil
2. p = psutil.Process(0)
3. p.set_cpu_affinity([0]) 

What is the expected output?  
Sets an affinity for process spawned via call to: osutil.execute(...) 

What do you see instead?  
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python\Python27\lib\site-packages\psutil\__init__.py", line 346, in 
set_cpu_affinity
    return self._platform_impl.set_process_cpu_affinity(cpus)
  File "c:\Python\Python27\lib\site-packages\psutil\_psmswindows.py", line 145, in wrapper
    raise AccessDenied(self.pid, self._process_name)
psutil.error.AccessDenied: (pid=0, name='System Idle Process') 

What version of psutil are you using? What Python version?  
psutil 0.5
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 

On what operating system? Is it 32bit or 64bit version?  
Win7 x64 SP1 

Please provide any additional information below.  
As described in Issue #238 this should be possible.

Original issue: http://code.google.com/p/psutil/issues/detail?id=291

@giampaolo
Copy link
Owner Author

From g.rodola on June 28, 2012 06:37:09

Not sure what problem you are referring to here.
Is PID 0 supposed to be an alias for "set an affinity for spawned process in advance"?
Is that stated somewhere?
I can't see anything like that in "man sched_setaffinity" on Ubuntu 12.04.

@giampaolo
Copy link
Owner Author

From maciej.l...@gmail.com on June 28, 2012 22:29:13

Yes, it is - unfortunately I cannot find a corresponding document at the moment.

I guess it should be sufficient to call:
psutil.Process(os.getpid()) and then start subprocess.

@giampaolo
Copy link
Owner Author

From g.rodola on June 29, 2012 04:45:44

That would seem to be more likely.
Also, even if PID 0 has the meaning you are suggesting, psutil is not 
misbehaving in raising AccessDenied: it just means you don't have the 
permission to perform that particular action (sched_setaffinity(3) call) in 
which case you might try to use the root user and see what happens.
Closing out as invalid for now. If you find any reference to PID 0 please reopen.

Status: Invalid
Labels: OpSys-Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant