Solved.
I had compiled the thrift bindings with '/usr/bin/thrift' which is v0.9.1,
like so: '/usr/bin/thrift --gen py ./storm.thrift'. The result behaved
as describe in my original email.
Today I just happened to notice the '*genThrift.sh*' script in
'*.../storm-core/src/*'
directory and within that file (glad I looked) a reference to a 'thrift7'
binary, which made me think v0.7 was needed.
No binaries for v0.7.0 is available, so I compiled thrift v0.7.0 using
archived
sources from here (as opposed to the archived source from Apache --
don't know
if it matters):
https://github.com/nathanmarz/thrift/archive/storm.zip
Note that the above was missing the file '*./compiler/cpp/**thrifty.h*',
which I
borrowed from within here (the Apache archive of thrift v0.7.0):
http://archive.apache.org/dist/thrift/0.7.0/thrift-0.7.0.tar.gz
And the above also required patching of the file '*lib/rb/ext/stuct.c*',
which
I got from here:
https://issues.apache.org/jira/secure/attachment/12501771/thrift-1382.patch
(Each of those caused compile failures).
Recreating the storm thrift python modules with the resulting
*/usr/local/bin/thrift*
(which is v0.7.0) seems to have resolve my issue (below).
My code for getting storm metrics from Nimbus and sending to Graphite works
now (fingers crossed the rest of the way).
I hope this helps someone.
On 02/19/2014 11:17 AM, Noel Milton Vega wrote:
Hello:
I'm using the Python Thrift interface/modules that I compiled using
Storm's v0.9.0.1
'*storm.thrift*' file (and python v*2.7.5*).
As illustrated next, if I run the python script below after launching
a topology, but
*before* passing any data through it, the script ALWAYS succeeds.
(It's a simple script).
However, when I pass some data through the topology (*even a tiny
bit*) and then re-run
the script, the script ALWAYS fails/excepts on line 27 with:
*TypeError: unhashable instance*.
Of course the underlying data structure contents changed when data was
passed through
the topology (perhaps triggering a bug?).
This is 100% reproducible: If I kill/restart the topology and repeat
this, the same
result will always happen. Do have a look below please.
Any ideas? Thank you in advance!
user@numbus$ *storm jar ./Storm.jar com.foo.bar.**My**Topology run01
# Start topology**. Data does not pass through until I allow it
(below).
*
user@nimbus$ *./clusterSummary.py
# Script listing is below. This succeeds.*
topology_id = run01-5-1392822221
TopologyInfo( [*Correct expected output here, (truncated for brevity)*] )
user@nimbus$ <Now here, I send data to MyTopology for literally just
2-seconds>
user@nimbus$ *./clusterSummary.py
# From now on, this will always fail on line 27.
*
topology_id = run01-5-1392822221
Traceback (most recent call last):
File "./clusterSummary.py", *line 27*, in <module>
print client.getTopologyInfo(topology_id)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/Nimbus.py",
line 586, in getTopologyInfo
return self.recv_getTopologyInfo()
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/Nimbus.py",
line 604, in recv_getTopologyInfo
result.read(self._iprot)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/Nimbus.py",
line 2832, in read
self.success.read(iprot)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/ttypes.py",
line 2726, in read
_elem265.read(iprot)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/ttypes.py",
line 2602, in read
self.stats.read(iprot)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/ttypes.py",
line 2393, in read
self.specific.read(iprot)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/ttypes.py",
line 2282, in read
self.bolt.read(iprot)
File
"/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d/storm/ttypes.py",
line 1927, in read
_val86[_key92] = _val93
TypeError: unhashable instance
*
*
*clusterSummary.py*
1 #! /usr/bin/env python
2
3 import sys
4
5
sys.path.append('/opt/STORM.d/latest/THRIFT.d/storm-0.9-python-thrift.d')
6
7 from thrift import Thrift
8 from thrift.transport import TSocket
9 from thrift.transport import TTransport
10 from thrift.protocol import TBinaryProtocol
11 from storm import Nimbus
12 from storm.ttypes import *
13 from storm.constants import *
14
15 nimbus_thrift_port = 6627
16 nimbus_host = 'nimbus'
17
18 try:
19 socket = TSocket.TSocket(nimbus_host, nimbus_thrift_port)
20 transport = TTransport.TFramedTransport(socket)
21 protocol = TBinaryProtocol.TBinaryProtocol(transport)
22 client = Nimbus.Client(protocol)
23
24 transport.open()
25 topology_id = client.getClusterInfo().topologies[0].id # Get
and save the (lone) topology ID.
26 print 'topology_id = %s\n' % topology_id # Just
to show we have the right topology ID.
27 print client.getTopologyInfo(topology_id) #(1) Succeeds on a
virgin topology (no tuples processed).
#(2) Always EXCEPTS after even a little data is passed through.
28 transport.close()
29
30 except Thrift.TException, tx:
31 print '%s' % (tx.message)