1

I am using rpyc (v 3.3.0) to get the list of processes running on a remote server using psutil module. My code is as below.

 server='hkl20056309'
 rpcClient = rpyc.classic.connect(server)
 rpsutil = rpcClient.modules.psutil
 procs = rpsutil.get_process_list()

I am getting the list of procs correctly but some of the processes attributes are not set correctly. for example:

>>> procs[166]._name
'mingetty'
>>> procs[140]._name
>>> procs[141]._name
>>> procs[142]._name
>>> procs[142]
<psutil.Process(pid=1828, name='gatengine') at 17483536>
>>> procs[142]._name
'gatengine'
>>>

If you see procs[142]._name is not printed (value is None) until I access the object. If I print all the processes, I see the name as None for 143rd process object in the list. But after I access the object, suddenly I can see the correct value for the name.

Any suggestions on how I can resolve this issue?

Alok
  • 3,160
  • 3
  • 28
  • 47
  • unfortunately I have to print the `procs` object to make sure all it's content are updated. Is this a known issue? – Alok Jan 06 '15 at 03:12

1 Answers1

1

Never seen such an issue with RPyC. It's probably something to do with that Process. If you call str(proc) and then proc._name, instead of printing, does it help? Also, it seems like you're trying to use a private member (_name)... Perhaps that's the issue? Isn't there some public property you can use?

sebulba
  • 1,245
  • 2
  • 10
  • 17