Beispiel #1
0
    def _get_bolt(self):
        """Returns Bolt protobuf message"""
        bolt = topology_pb2.Bolt()
        bolt.comp.CopyFrom(self._get_base_component())

        # Add streams
        self._add_in_streams(bolt)
        self._add_out_streams(bolt)
        return bolt
Beispiel #2
0
 def create_mock_bolt(self, bolt_name, input_streams, output_streams,
                      bolt_parallelism):
     bolt = protoTopology.Bolt()
     bolt.comp.name = bolt_name
     kv = bolt.comp.config.kvs.add()
     kv.key = constants.TOPOLOGY_COMPONENT_PARALLELISM
     kv.value = str(bolt_parallelism)
     for stream in input_streams:
         bolt.inputs.add().stream.CopyFrom(stream)
     for stream in output_streams:
         bolt.outputs.add().stream.CopyFrom(stream)
     return bolt
Beispiel #3
0
def get_mock_bolt(component=get_mock_component(), inputs=[], outputs=[]):
    """Returns a mock protobuf Bolt object from topology_pb2"""
    bolt = topology_pb2.Bolt()
    bolt.comp.CopyFrom(component)

    for i in inputs:
        added = bolt.inputs.add()
        added.CopyFrom(i)

    for o in outputs:
        added = bolt.outputs.add()
        added.CopyFrom(o)

    return bolt