Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Capability refactor #53

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open

Conversation

sphaero
Copy link
Contributor

@sphaero sphaero commented Jan 7, 2015

Implemented a ZOCPParameter class with necessary functionality. It tracks a list of parameters by itself including the id's.
unittests are ok (hopefully travis as well). It still needs work on the signals!

sphaero added 10 commits January 4, 2015 14:09
added ZOCPParameterList class for tracking ZOCPParameters
ZOCPParameter is now maintaining the list of parameters by itself
value was missing in dict output
added __dict__ method
changed __repr__ method to out class instance syntax
added dict output test
skipped serialize test as it is kind of difficult and not needed (yet)
replaced capabilty dictionary construction with ZOCPParameter class
@sphaero
Copy link
Contributor Author

sphaero commented Jan 7, 2015

Ow btw a discussion was at #42

…iple nodes in one process). It's now done through members passed to the class (for testing) or retrieved from the zocp instance passed to the class (_params_list, _monitor_subscribers)

removed self.subscriptions, not needed and done by the zocp class
added (un)subscribe_receiver methods, replaces signal_subscribe* methods
refactored unittest to reflect changes
register methods now return a ZOCPParameter
signal methods now work with signal ids and ZOCPParameter instances
emit_signal method is deprecated
self.subscribers -> self.monitor_subscribers = set()
fix monitor_subscribers var name
refactored unittest to reflect changes
@sphaero
Copy link
Contributor Author

sphaero commented Jan 8, 2015

The travis fail was because of zeromq/pyre#48
No idea why it only showed up on python 3.2???

@sphaero
Copy link
Contributor Author

sphaero commented Jan 8, 2015

Been testing with the node editor. Actually got quite far :) Nodes show up in the editor and I can manage subscriptions. However editing from the urwid monitor:

Traceback (most recent call last):
  File "signal_subscriber.py", line 34, in <module>
    z.run()
  File "signal_subscriber.py", line 20, in run
    super().run()
  File "/home/arnaud/src/pyZOCP/src/zocp.py", line 799, in run
    self.get_message()
  File "/home/arnaud/src/pyZOCP/src/zocp.py", line 612, in get_message
    self._handle_SET(msg[method], peer, name, grp)
  File "/home/arnaud/src/pyZOCP/src/zocp.py", line 652, in _handle_SET
    self._on_modified(data, peer, name)
  File "/home/arnaud/src/pyZOCP/src/zocp.py", line 751, in _on_modified
    for subscriber in self.subscribers:
AttributeError: 'SubscriberNode' object has no attribute 'subscribers'

subscribee doesn't show up in urwid.

@sphaero
Copy link
Contributor Author

sphaero commented Jan 8, 2015

also an error in urwid on nodeeditor exit:
line 571 in get_message subscribers doesn't exists. (can't copy paste)

sphaero added 10 commits January 8, 2015 22:33
fixed set_object
fixed _on_modified argument in signal_(un)subscribe
removed unittest skips
some tweaking of monitor subscribe test as the monitor needs some time to get messages from nodes
changed example to use signal ids
changed signal_monitor test to give more chance for messages to arrive
@sphaero
Copy link
Contributor Author

sphaero commented Jan 14, 2015

I don't understand why travis is failing:

WARNING:pyre.pyre_node:{}
WARNING:pyre.pyre_node:We don't know peer id 94d33670-0bbb-406e-aedc-e5ca55ff9ca7
WARNING:pyre.pyre_node:{}
WARNING:pyre.pyre_node:We don't know peer id 4847a7d3-116a-4584-9c10-7156105887d3

those are weird errors which I can' reproduce

@sphaero
Copy link
Contributor Author

sphaero commented Jan 15, 2015

A combination of these tests gives an exception sometimes:

test_object_param
test_param
test_signal_monitor/test_signal_subscribe
test_emit_signal (test_zocp.ZOCPTest) ... skipped 'skip'
test_get_name (test_zocp.ZOCPTest) ... skipped 'skip'
test_get_own_groups (test_zocp.ZOCPTest) ... skipped 'skip'
test_get_peer_address (test_zocp.ZOCPTest) ... skipped 'skip'
test_get_peer_groups (test_zocp.ZOCPTest) ... skipped 'skip'
test_get_peer_header_value (test_zocp.ZOCPTest) ... skipped 'skip'
test_get_peers (test_zocp.ZOCPTest) ... skipped 'skip'
test_object_param (test_zocp.ZOCPTest) ... WARNING:root:can't set ROUTER_HANDOVER, needs zmq version >=4.1 but installed is 4.0.4
WARNING:root:can't set ROUTER_HANDOVER, needs zmq version >=4.1 but installed is 4.0.4
/usr/local/lib/python3.4/dist-packages/zmq/sugar/socket.py:89: DeprecationWarning: Socket.socket_type is deprecated, use Socket.type
  DeprecationWarning
ok
test_param (test_zocp.ZOCPTest) ... WARNING:root:can't set ROUTER_HANDOVER, needs zmq version >=4.1 but installed is 4.0.4
WARNING:root:can't set ROUTER_HANDOVER, needs zmq version >=4.1 but installed is 4.0.4
ok
test_signal_monitor (test_zocp.ZOCPTest) ... skipped 'skip'
test_signal_subscribe (test_zocp.ZOCPTest) ... WARNING:root:can't set ROUTER_HANDOVER, needs zmq version >=4.1 but installed is 4.0.4
WARNING:root:can't set ROUTER_HANDOVER, needs zmq version >=4.1 but installed is 4.0.4
Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/home/people/arnaud/src/pyre/pyre/zactor.py", line 58, in run
    self.shim_handler(*self.shim_args, **self.shim_kwargs)
  File "/home/people/arnaud/src/pyre/pyre/pyre_node.py", line 52, in __init__
    self.run()
  File "/home/people/arnaud/src/pyre/pyre/pyre_node.py", line 480, in run
    items = dict(self.poller.poll(timeout * 1000))
  File "/usr/local/lib/python3.4/dist-packages/zmq/sugar/poll.py", line 101, in poll
    return zmq_poll(self.sockets, timeout=timeout)
  File "zmq/backend/cython/_poll.pyx", line 115, in zmq.backend.cython._poll.zmq_poll (zmq/backend/cython/_poll.c:1589)
  File "zmq/backend/cython/checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/_poll.c:2019)
zmq.error.ZMQError: Socket operation on non-socket

Upgraded zmq to 4.1 and now running without trouble.... weird. Might cause travis build fail as well

@sphaero
Copy link
Contributor Author

sphaero commented Jan 15, 2015

After a long run I still got an error:

======================================================================
ERROR: test_param (test_zocp.ZOCPTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/people/arnaud/src/pyZOCP/tests/test_zocp.py", line 26, in tearDown
    self.node1.stop()
  File "/home/people/arnaud/src/pyre/pyre/pyre.py", line 95, in stop
    self.actor.resolve().wait()
  File "/home/people/arnaud/src/pyre/pyre/zsocket.py", line 36, in wait
    msg = self.recv()
  File "zmq/backend/cython/socket.pyx", line 631, in zmq.backend.cython.socket.Socket.recv (zmq/backend/cython/socket.c:5775)
  File "zmq/backend/cython/socket.pyx", line 665, in zmq.backend.cython.socket.Socket.recv (zmq/backend/cython/socket.c:5575)
  File "zmq/backend/cython/socket.pyx", line 139, in zmq.backend.cython.socket._recv_copy (zmq/backend/cython/socket.c:1728)
  File "zmq/backend/cython/checkrc.pxd", line 15, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/socket.c:6115)
zmq.error.Again: Resource temporarily unavailable

seems the frontend is waiting for the backend to signal stop however either the frontend or the backend is already gone

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

Successfully merging this pull request may close these issues.

1 participant