本文整理汇总了Java中backtype.storm.drpc.LinearDRPCTopologyBuilder类的典型用法代码示例。如果您正苦于以下问题:Java LinearDRPCTopologyBuilder类的具体用法?Java LinearDRPCTopologyBuilder怎么用?Java LinearDRPCTopologyBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearDRPCTopologyBuilder类属于backtype.storm.drpc包,在下文中一共展示了LinearDRPCTopologyBuilder类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
if (args == null || args.length == 0) {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
String[] urlsToTry = new String[]{ "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com" };
for (String url : urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(6);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:desp0916,项目名称:LearnStorm,代码行数:26,代码来源:ReachTopology.java
示例2: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[]{ "hello", "goodbye" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:luozhaoyu,项目名称:big-data-system,代码行数:25,代码来源:BasicDRPCTopology.java
示例3: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[] { "hello", "goodbye" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
Thread.sleep(10000);
drpc.shutdown();
cluster.shutdown();
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:desp0916,项目名称:LearnStorm,代码行数:23,代码来源:DRPCTest.java
示例4: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[]{ "hello", "goodbye", "apple", "orange", "banana" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
Thread.sleep(10000);
drpc.shutdown();
cluster.shutdown();
}
else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:desp0916,项目名称:LearnStorm,代码行数:26,代码来源:BasicDRPCTopology.java
示例5: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
if (args == null || args.length == 0) {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
String[] urlsToTry = new String[]{ "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com" };
for (String url : urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(6);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:metamx,项目名称:incubator-storm,代码行数:26,代码来源:ReachTopology.java
示例6: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[]{ "hello", "goodbye" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:metamx,项目名称:incubator-storm,代码行数:25,代码来源:BasicDRPCTopology.java
示例7: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
if(args==null || args.length==0) {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com"};
for(String url: urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
}
cluster.shutdown();
drpc.shutdown();
} else {
conf.setNumWorkers(6);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:adarshms,项目名称:sentweet,代码行数:25,代码来源:ReachTopology.java
示例8: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if(args==null || args.length==0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for(String word: new String[] {"hello", "goodbye"}) {
System.out.println("Result for \"" + word + "\": "
+ drpc.execute("exclamation", word));
}
cluster.shutdown();
drpc.shutdown();
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
开发者ID:adarshms,项目名称:sentweet,代码行数:25,代码来源:BasicDRPCTopology.java
示例9: construct
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static LinearDRPCTopologyBuilder construct() {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder(TOPOLOGY_NAME);
builder.addBolt(new GetTweeters(), 1);
builder.addBolt(new GetFollowers(), 1)
.shuffleGrouping();
builder.addBolt(new PartialUniquer(), 1)
.fieldsGrouping(new Fields("id", "follower"));
builder.addBolt(new CountAggregator(), 1)
.fieldsGrouping(new Fields("id"));
return builder;
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:12,代码来源:ReachTopology.java
示例10: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
conf.setNumWorkers(6);
if (args.length == 0) {
StormSubmitter.submitTopology(TOPOLOGY_NAME, conf, builder.createRemoteTopology());
}else {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createLocalTopology(drpc));
JStormUtils.sleepMs(50000);
String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com"};
for(String url: urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute(TOPOLOGY_NAME, url));
}
cluster.shutdown();
drpc.shutdown();
}
}
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:29,代码来源:ReachTopology.java
示例11: construct
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static LinearDRPCTopologyBuilder construct() {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("reach");
builder.addBolt(new GetTweeters(), 4);
builder.addBolt(new GetFollowers(), 12).shuffleGrouping();
builder.addBolt(new PartialUniquer(), 6).fieldsGrouping(new Fields("id", "follower"));
builder.addBolt(new CountAggregator(), 3).fieldsGrouping(new Fields("id"));
return builder;
}
开发者ID:luozhaoyu,项目名称:big-data-system,代码行数:9,代码来源:ReachTopology.java
示例12: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
conf.setNumWorkers(6);
if (args.length != 0) {
try {
Map yamlConf = LoadConf.LoadYaml(args[0]);
if (yamlConf != null) {
conf.putAll(yamlConf);
}
}catch (Exception e) {
System.out.println("Input " + args[0] + " isn't one yaml ");
}
StormSubmitter.submitTopology(TOPOLOGY_NAME, conf, builder.createRemoteTopology());
}else {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createLocalTopology(drpc));
JStormUtils.sleepMs(50000);
String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com"};
for(String url: urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute(TOPOLOGY_NAME, url));
}
cluster.shutdown();
drpc.shutdown();
}
}
开发者ID:kkllwww007,项目名称:jstrom,代码行数:39,代码来源:ReachTopology.java
示例13: construct
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static LinearDRPCTopologyBuilder construct() {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("reach");
builder.addBolt(new GetTweeters(), 4);
builder.addBolt(new GetFollowers(), 12)
.shuffleGrouping();
builder.addBolt(new PartialUniquer(), 6)
.fieldsGrouping(new Fields("id", "follower"));
builder.addBolt(new CountAggregator(), 3)
.fieldsGrouping(new Fields("id"));
return builder;
}
开发者ID:adarshms,项目名称:sentweet,代码行数:12,代码来源:ReachTopology.java
示例14: construct
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static LinearDRPCTopologyBuilder construct() {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder(TOPOLOGY_NAME);
builder.addBolt(new GetTweeters(), 1);
builder.addBolt(new GetFollowers(), 1).shuffleGrouping();
builder.addBolt(new PartialUniquer(), 1).fieldsGrouping(new Fields("id", "follower"));
builder.addBolt(new CountAggregator(), 1).fieldsGrouping(new Fields("id"));
return builder;
}
开发者ID:alibaba,项目名称:jstorm,代码行数:9,代码来源:ReachTopology.java
示例15: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
conf.setNumWorkers(6);
if (args.length != 0) {
try {
Map yamlConf = LoadConf.LoadYaml(args[0]);
if (yamlConf != null) {
conf.putAll(yamlConf);
}
} catch (Exception e) {
System.out.println("Input " + args[0] + " isn't one yaml ");
}
StormSubmitter.submitTopology(TOPOLOGY_NAME, conf, builder.createRemoteTopology());
} else {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createLocalTopology(drpc));
JStormUtils.sleepMs(10000);
String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com" };
for (String url : urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute(TOPOLOGY_NAME, url));
}
cluster.shutdown();
drpc.shutdown();
}
}
开发者ID:alibaba,项目名称:jstorm,代码行数:37,代码来源:ReachTopology.java
示例16: main
import backtype.storm.drpc.LinearDRPCTopologyBuilder; //导入依赖的package包/类
public static void main(String[] args){
// first some global (topology configuration)
StormCVConfig conf = new StormCVConfig();
conf.put(StormCVConfig.STORMCV_OPENCV_LIB, "mac64_opencv_java248.dylib");
conf.setNumWorkers(5); // number of workers in the topology
conf.put(StormCVConfig.STORMCV_FRAME_ENCODING, Frame.JPG_IMAGE); // indicates frames will be encoded as JPG throughout the topology (JPG is the default when not explicitly set)
conf.put(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS, true); // True if Storm should timeout messages or not.
conf.put(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS , 10); // The maximum amount of time given to the topology to fully process a message emitted by a spout (default = 30)
conf.put(StormCVConfig.STORMCV_SPOUT_FAULTTOLERANT, false); // indicates if the spout must be fault tolerant; i.e. spouts do NOT! replay tuples on fail
conf.put(StormCVConfig.STORMCV_CACHES_TIMEOUT_SEC, 30); // TTL (seconds) for all elements in all caches throughout the topology (avoids memory overload)
conf.put(Config.NIMBUS_TASK_LAUNCH_SECS, 30);
String userDir = System.getProperty("user.dir").replaceAll("\\\\", "/");
List<String> prototypes = new ArrayList<String>();
prototypes.add( "file://"+ userDir +"/resources/data" );
// create a linear DRPC builder called 'match'
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("match");
//add a FeatureMatchRequestOp that receives drpc requests
builder.addBolt(new RequestBolt(new FeatureMatchRequestOp()), 1);
// add two bolts that perform sift extraction (as used in other examples!)
builder.addBolt(new SingleInputBolt(
new FeatureExtractionOp("sift", FeatureDetector.SIFT, DescriptorExtractor.SIFT).outputFrame(false)
), 1).shuffleGrouping();
// add bolt that matches queries it gets with the prototypes it has loaded upon the prepare.
// The prototypes are divided over the available tasks which means that each query has to be send to all tasks (use allGrouping)
// the matcher only reports a match if at least 1 strong match has been found (can be set to 0)
builder.addBolt(new SingleInputBolt(new PartialMatcher(prototypes, 0, 0.5f)), 2).allGrouping();
// add a bolt that aggregates all the results it gets from the two matchers
builder.addBolt(new BatchBolt(new FeatureMatchResultOp(true)), 1).fieldsGrouping(new Fields(CVParticleSerializer.REQUESTID));
// create local drpc server and cluster. Deploy the drpc topology on the cluster
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
// use all face images as queries (same images as loaded by the matcher!)
File queryDir = new File(userDir +"/resources/data/");
for(String img : queryDir.list()){
if(!img.endsWith(".jpg")) continue; // to avoid reading non-image files
// execute the drpc with the image as argument. Note that the execute blocks
String matchesJson = drpc.execute("match", "file://"+userDir +"/resources/data/"+img);
System.out.println(img+" : " + matchesJson);
}
cluster.shutdown();
drpc.shutdown();
}
开发者ID:sensorstorm,项目名称:StormCV,代码行数:56,代码来源:E8_DRPCTopology.java
注:本文中的backtype.storm.drpc.LinearDRPCTopologyBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论