java - Error with Apache Storm topology -
i have been trying create simple storm topology, keep running error. i'm creating spout using python. have been using this reference. topology given below:
public class testtopology { public static void main(string[] args) throws exception { topologybuilder builder = new topologybuilder(); builder.setspout("sentencespout",new sentencespout(), 1); config cfg = new config(); stormsubmitter.submittopology("testtopology", cfg, builder.createtopology()); }
this sentencespout looks :
import java.util.map; import backtype.storm.config; import backtype.storm.spout.shellspout; import backtype.storm.topology.irichspout; import backtype.storm.topology.outputfieldsdeclarer; import backtype.storm.tuple.fields; public class sentencespout extends shellspout implements irichspout { // invoke python spout public sentencespout() { super("python", "python/test/sentencespout.py"); } // declare emit 'sentence' field @override public void declareoutputfields(outputfieldsdeclarer declarer) { declarer.declare(new fields("sentence")); } // no real configuration going on @override public map<string, object> getcomponentconfiguration() { return null; } }
and sentencespout.py looks :
import storm import random sentences = """ cow jumped on moon apple day keeps doctor away 4 score , 7 years ago snow white , 7 dwarfs @ 2 nature """.strip().split('\n') class sentencespout(storm.spout): def initialize(self,conf,context): self._conf = conf self._context = context storm.loginfo("spout instance starting....") def nexttuple(self): sentence = random.choice(sentences) storm.loginfo("emiting %s" % sentence) storm.emit([sentence]) sentencespout().run()
my topology builds absolutely fine. , can see topology on storm ui. keep getting error,however :
java.lang.runtimeexception: pid:5130, name:sentencespout exitcode:-1, errorstring: @ backtype.storm.spout.shellspout.querysubprocess(shellspout.java:178) @ backtype.storm.spout.shellspout.nexttuple(shellspout.java:91) @ backtype.storm.daemon.executor$fn__3373$fn__3388$fn__3417.invoke(executor.clj:565) @ backtype.storm.util$async_loop$fn__464.invoke(util.clj:463) @ clojure.lang.afn.run(afn.java:24) @ java.lang.thread.run(thread.java:745) caused by: java.lang.runtimeexception: unknown command received: error @ backtype.storm.spout.shellspout.querysubprocess(shellspout.java:173)
is there can me out on this? appreciate it.
Comments
Post a Comment