srri-zz / OpenRelay

Peer based web hosting
peer.to/peer
16 stars 0 forks source link

Find alternative to /proc/stat for OSX #7

Closed amanjeev closed 12 years ago

amanjeev commented 12 years ago

I see the instances trying to access /proc/stat on my Mac OSX and failing IOError: [Errno 2] No such file or directory: '/proc/stat'

Please chime in if anyone else knows about it.

ghost commented 12 years ago

That's the Heartbeat API call trying to determine the CPU load of the node. The CPU load is used to determine if the node is alive and the order which the nodes will be queried for a resource.

https://github.com/Captainkrtek/OpenRelay/blob/master/apps/server_talk/utils.py#L12

ghost commented 12 years ago

This looks good: http://code.google.com/p/psutil/

ghost commented 12 years ago

I've made the updates to use psutil, git fetch, merge and give it a try.

https://github.com/Captainkrtek/OpenRelay/commit/0a03a0440c8f0cb7c8ece176cabc1b3c009e387e#commitcomment-1010406

amanjeev commented 12 years ago

Just did that and it seems to work. Nodes are working with "Up" status.

Are you able to view the nodelist? I cannot. It throws index out of bound. I do not have time at the moment, hopefully tomorrow I will be able to see this.

TemplateSyntaxError: Caught IndexError while rendering: list index out of range

amanjeev commented 12 years ago

This issue is done. Thanks a lot Roberto!

ghost commented 12 years ago

@amanjeev No problem :) The IndexError appears to be caused by model getting out of sync most likely because of an error during the node or resource creation routine, go to the admin interface and delete the offending records. Transaction handling will fix this but since SQLite doesn't handle transactions a few try/except block will be needed to ensure the data is not left in an unstable state.

amanjeev commented 12 years ago

I realized that the IndexError happens everytime I upload a new set of file (to either of the running nodes). The reason being that the files fail to be signed. I think the problem is the same as what I had with my linux machine. Perhaps a fresh install should do.


Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 530, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 483, in run
    self.__target(_self.__args, *_self.__kwargs)
  File "/Users/AJ/work/projects/OpenRelay/lib/python2.7/site-packages/gnupg.py", line 536, in _read_response
    result.handle_status(keyword, value)
  File "/Users/AJ/work/projects/OpenRelay/lib/python2.7/site-packages/gnupg.py", line 446, in handle_status
    raise ValueError("Unknown status message: %r" % key)
ValueError: Unknown status message: u'ERROR'

ERROR:gnupg:Error sending data
Traceback (most recent call last):
  File "/Users/AJ/work/projects/OpenRelay/lib/python2.7/site-packages/gnupg.py", line 84, in _copy_data
    outstream.write(data)
IOError: [Errno 32] Broken pipe```