Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ooici/pyon into stream_def
Browse files Browse the repository at this point in the history
  • Loading branch information
lukecampbell committed Jul 9, 2012
2 parents 4d5eadf + a2e66cb commit 0f35d67
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pyon/datastore/couchdb/couchdb_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
},
'manifest': {
'by_dataset' : {
'map' : 'function(doc) { var i = Number(doc.ts_create); emit([doc.dataset_id, doc.ts_create], doc._id); }'
'map' : 'function(doc) { var i = Number(doc.ts_create); emit([doc.dataset_id, i], doc._id); }'
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions pyon/net/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,16 @@ def _purge(self):

class PublisherChannel(SendChannel):
def __init__(self, close_callback=None):
self._declared = False
SendChannel.__init__(self, close_callback=close_callback)

def send(self, data, headers=None):
if not self._declared:
assert self._send_name and self._send_name.exchange
self._declare_exchange(self._send_name.exchange)
self._declared = True
"""
Send override that ensures the exchange is declared, always.
Avoids the auto-delete exchange problem in integration tests with Publishers.
"""
assert self._send_name and self._send_name.exchange
self._declare_exchange(self._send_name.exchange)
SendChannel.send(self, data, headers=headers)

class BidirClientChannel(SendChannel, RecvChannel):
Expand Down Expand Up @@ -878,7 +880,10 @@ def accept(self, n=1, timeout=None):

if not was_consuming:
# turn consuming back off if we already were off
self.stop_consume()
if not self._queue_auto_delete:
self.stop_consume()
else:
log.debug("accept should turn consume off, but queue is auto_delete and this would destroy the queue")

ms = [self.recv() for x in xrange(n)]

Expand Down
8 changes: 0 additions & 8 deletions pyon/net/test/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ def test_verify_service(self, mocksendchannel):

def test_init(self, mocksendchannel):
pubchan = PublisherChannel()
self.assertFalse(pubchan._declared)

def test_send_no_name(self, mocksendchannel):
pubchan = PublisherChannel()
Expand All @@ -672,13 +671,6 @@ def test_send(self, mocksendchannel):

depmock.assert_called_once_with(sentinel.xp)
mocksendchannel.send.assert_called_once_with(pubchan, sentinel.data, headers=None)
self.assertTrue(pubchan._declared)

# call send again, to show declare is not called again
pubchan.send(sentinel.data2)
depmock.assert_called_once_with(sentinel.xp)
self.assertEquals(mocksendchannel.send.call_count, 2)
mocksendchannel.send.assert_called_with(pubchan, sentinel.data2, headers=None)

@attr('UNIT')
@patch('pyon.net.channel.SendChannel')
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
test_suite = 'pyon',
package_data = {'': ['*.xml']},
install_requires = [
# Patched greenlet to work on ARMS
'greenlet==0.3.1-p1',
'greenlet==0.4.0',
'gevent==0.13.6',
'simplejson==2.1.6',
'msgpack-python==0.1.13',
Expand Down

0 comments on commit 0f35d67

Please sign in to comment.