Пример #1
0
    def createTopology(self):
        boltSpecs = {}
        spoutSpecs = {}
        for boltId, bolt in self._bolts.iteritems():
            t_bolt = Bolt()
            shell_object = ShellComponent()
            shell_object.execution_command = bolt.execution_command
            shell_object.script = bolt.script
            t_bolt.bolt_object = ComponentObject()
            t_bolt.bolt_object.shell = shell_object
            t_bolt.common = self._getComponentCommon(boltId, bolt)
            boltSpecs[boltId] = t_bolt

        for spoutId, spout in self._spouts.iteritems():
            spout_spec = SpoutSpec()
            shell_object = ShellComponent()
            shell_object.execution_command = spout.execution_command
            shell_object.script = spout.script
            spout_spec.spout_object = ComponentObject()
            spout_spec.spout_object.shell = shell_object
            spout_spec.common = self._getComponentCommon(spoutId, spout)
            spoutSpecs[spoutId] = spout_spec

        topology = StormTopology()
        topology.spouts = spoutSpecs
        topology.bolts = boltSpecs
        topology.state_spouts = {}  # Not supported yet, I think
        return topology
Пример #2
0
    def createTopology(self):
        boltSpecs = {}
        spoutSpecs = {}
        for boltId, bolt in self._bolts.iteritems():
            t_bolt = Bolt()
            shell_object = ShellComponent()
            shell_object.execution_command = bolt.execution_command
            shell_object.script = bolt.script
            t_bolt.bolt_object = ComponentObject()
            t_bolt.bolt_object.shell = shell_object
            t_bolt.common = self._getComponentCommon(boltId, bolt)
            boltSpecs[boltId] = t_bolt

        for spoutId, spout in self._spouts.iteritems():
            spout_spec = SpoutSpec()
            shell_object = ShellComponent()
            shell_object.execution_command = spout.execution_command
            shell_object.script = spout.script
            spout_spec.spout_object = ComponentObject()
            spout_spec.spout_object.shell = shell_object
            spout_spec.common = self._getComponentCommon(spoutId, spout)
            spoutSpecs[spoutId] = spout_spec

        topology = StormTopology()
        topology.spouts = spoutSpecs
        topology.bolts = boltSpecs
        topology.state_spouts = {} # Not supported yet, I think
        return topology
Пример #3
0
 def read_it(stream):
     bytes = stream.read()
     transportIn = TTransport.TMemoryBuffer(bytes)
     protocolIn = TBinaryProtocol.TBinaryProtocol(transportIn)
     topology = StormTopology()
     topology.read(protocolIn)
     return topology
Пример #4
0
 def read_it(stream):
     bytes = stream.read()
     transportIn = TTransport.TMemoryBuffer(bytes)
     protocolIn = TBinaryProtocol.TBinaryProtocol(transportIn)
     topology = StormTopology()
     topology.read(protocolIn)
     return topology