简体   繁体   English

从Python Bot调用Apache Storm

[英]Apache Storm calling function from python bolt

I have a simple storm bolt which only needs to call a function from another python module. 我有一个简单的风暴螺栓,只需要从另一个python模块调用函数即可。 Everything works until I call a method which has print statements inside the function. 一切正常,直到我调用一个在函数内部具有打印语句的方法为止。

So my bolt: 所以我的螺栓:

import storm
from pipeline import module as m

class ExampleBolt(storm.BasicBolt): 

    def initialize(self, conf, context):
        self._conf = conf;
        self._context = context;
        storm.logInfo("ExampleBolt instance starting ...")

    def process(self, tuple):
        id, text = tuple.values
        result = m.dummy_funct(text)        
        storm.emit([result])         


ExampleBolt().run()

the method: 方法:

def dummy_funct(text):
    print "log info"
    return text

The bolt calls the method one time and then hangs on output. 螺栓一次调用该方法,然后挂在输出上。 Using Apache Storm 0.9.3 使用Apache Storm 0.9.3

Check that, whether from second time only process block is getting executed. 检查是否从第二次开始仅执行过程块。
Not the whole program is getting executed. 并非整个程序都在执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM