Beispiel #1
0
 def initialize(self, config, context):
   self.logger.debug("GeneratorSpout's Component-specific config: \n%s" % str(config))
   self.emitted = 0
   if GeneratorSpout.GENERATOR in config:
     self._generator = config[GeneratorSpout.GENERATOR]
   else:
     raise RuntimeError("GeneratorSpout needs to be passed generator function")
   if hasattr(self, '_state'):
     contextimpl = ContextImpl(context, self._state, self)
   else:
     contextimpl = ContextImpl(context, None, self)
   self._generator.setup(contextimpl)
Beispiel #2
0
 def initialize(self, config, context):
   self.logger.debug("TransformBolt's Component-specific config: \n%s" % str(config))
   self.processed = 0
   self.emitted = 0
   if TransformBolt.OPERATOR in config:
     self._transform_operator = config[TransformBolt.OPERATOR]
   else:
     raise RuntimeError("TransformBolt needs to be passed transform_operator")
   if hasattr(self, '_state'):
     contextimpl = ContextImpl(context, self._state, self)
   else:
     contextimpl = ContextImpl(context, None, self)
   self._transform_operator.setup(contextimpl)