[storm] Profiling project: instrumenting find()

Jeroen Vermeulen jtv at canonical.com
Wed Aug 3 09:22:10 UTC 2011


On 2011-07-01 15:03, Bozo Dragojevic wrote:

>> Are there any other ways?
>
> (c) create a marker class for the first argument to find
>
>    >>>  class ReferenceLoad(tuple):
>    ...   __slots__ = ()
>    ...
>    >>>
>    >>>  class MyStorm(object):
>    ...   pass
>    ...
>    >>>  a=ReferenceLoad((MyStorm,))
>    >>>  a
>    (<class '__main__.MyStorm'>,)
>    >>>  a[0]
>    <class '__main__.MyStorm'>
>    >>>  isinstance(a,ReferenceLoad)
>    True

Getting around to this at last!  Thanks for the suggestion.  There's one 
part in it that I don't understand: the "a[0]".  How does that work?

Are you suggesting to derive a class (from the Storm-backed class plus 
the marker) on the fly every time a dereference calls find?  It's a 
clever trick but I'm a bit worried that it may upset Storm.  I recently 
ran into some problems with a class derived from a Storm-backed class. 
That was relatively straightforward inheritance, but it caused problems 
with Storm's property lookup.


Jeroen



More information about the storm mailing list