org.apache.storm.utils.Utils.readCommandLineOpts()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.apache.storm.utils.Utils.readCommandLineOpts()方法的一些代码示例,展示了Utils.readCommandLineOpts()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.readCommandLineOpts()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:readCommandLineOpts

Utils.readCommandLineOpts介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public static Map<String, Object> readStormConfig() {
  Map<String, Object> ret = readDefaultConfig();
  String confFile = System.getProperty("storm.conf.file");
  Map<String, Object> storm;
  if (confFile == null || confFile.equals("")) {
    storm = findAndReadConfigFile("storm.yaml", false);
  } else {
    storm = findAndReadConfigFile(confFile, true);
  }
  ret.putAll(storm);
  ret.putAll(readCommandLineOpts());
  return ret;
}

代码示例来源:origin: apache/storm

/**
 * Copies text file content from sourceDir to destinationDir. Moves source files into sourceDir after its done consuming
 */
public static void main(String[] args) throws Exception {
  if (args.length != 2) {
    System.err.println("args: runDurationSec topConfFile");
    return;
  }
  Integer durationSec = Integer.parseInt(args[0]);
  String confFile = args[1];
  Map<String, Object> topoConf = Utils.findAndReadConfigFile(confFile);
  topoConf.put(Config.TOPOLOGY_PRODUCER_BATCH_SIZE, 1000);
  topoConf.put(Config.TOPOLOGY_DISABLE_LOADAWARE_MESSAGING, true);
  topoConf.put(Config.TOPOLOGY_STATS_SAMPLE_RATE, 0.0005);
  topoConf.put(Config.TOPOLOGY_BOLT_WAIT_STRATEGY, "org.apache.storm.policy.WaitStrategyPark");
  topoConf.put(Config.TOPOLOGY_BOLT_WAIT_PARK_MICROSEC, 0);
  topoConf.putAll(Utils.readCommandLineOpts());
  //  Submit topology to Storm cluster
  Helper.runOnClusterAndPrintMetrics(durationSec, TOPOLOGY_NAME, topoConf, getTopology(topoConf));
}

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
  int runTime = -1;
  Map<String, Object> topoConf = Utils.findAndReadConfigFile(args[1]);
  topoConf.put(Config.TOPOLOGY_SPOUT_RECVQ_SKIPS, 1);
  if (args.length > 0) {
    long sleepMs = Integer.parseInt(args[0]);
    topoConf.put(SLEEP_MS, sleepMs);
  }
  if (args.length > 1) {
    runTime = Integer.parseInt(args[1]);
  }
  if (args.length > 2) {
    System.err.println("args: spoutSleepMs [runDurationSec] ");
    return;
  }
  topoConf.putAll(Utils.readCommandLineOpts());
  //  Submit topology to storm cluster
  Helper.runOnClusterAndPrintMetrics(runTime, "LowThroughputTopo", topoConf, getTopology(topoConf));
}

代码示例来源:origin: apache/storm

/**
 * Spout generates random strings and HDFS bolt writes them to a text file
 */
public static void main(String[] args) throws Exception {
  String confFile = "conf/HdfsSpoutTopo.yaml";
  int runTime = -1; //Run until Ctrl-C
  if (args.length > 0) {
    runTime = Integer.parseInt(args[0]);
  }
  if (args.length > 1) {
    confFile = args[1];
  }
  //  Submit to Storm cluster
  if (args.length > 2) {
    System.err.println("args: [runDurationSec] [confFile]");
    return;
  }
  Map<String, Object> topoConf = Utils.findAndReadConfigFile(confFile);
  topoConf.put(Config.TOPOLOGY_PRODUCER_BATCH_SIZE, 1000);
  topoConf.put(Config.TOPOLOGY_BOLT_WAIT_STRATEGY, "org.apache.storm.policy.WaitStrategyPark");
  topoConf.put(Config.TOPOLOGY_BOLT_WAIT_PARK_MICROSEC, 0);
  topoConf.put(Config.TOPOLOGY_DISABLE_LOADAWARE_MESSAGING, true);
  topoConf.put(Config.TOPOLOGY_STATS_SAMPLE_RATE, 0.0005);
  topoConf.putAll(Utils.readCommandLineOpts());
  Helper.runOnClusterAndPrintMetrics(runTime, TOPOLOGY_NAME, topoConf, getTopology(topoConf));
}

代码示例来源:origin: apache/storm

fullConf.putAll(Utils.readCommandLineOpts());
fullConf.putAll(conf);

代码示例来源:origin: apache/storm

throws AuthorizationException, NotAliveException, InvalidTopologyException {
topoConf = new HashMap(topoConf);
topoConf.putAll(Utils.readCommandLineOpts());
Map<String, Object> conf = Utils.readStormConfig();
conf.putAll(topoConf);

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
  int runTime = -1;
  Config topoConf = new Config();
  topoConf.put(Config.TOPOLOGY_SPOUT_RECVQ_SKIPS, 1);
  topoConf.putAll(Utils.readCommandLineOpts());
  if (args.length > 0) {
    long sleepMs = Integer.parseInt(args[0]);
    topoConf.put(SLEEP_MS, sleepMs);
  }
  if (args.length > 1) {
    runTime = Integer.parseInt(args[1]);
  }
  if (args.length > 2) {
    System.err.println("args: boltSleepMs [runDurationSec] ");
    return;
  }
  //  Submit topology to storm cluster
  Helper.runOnClusterAndPrintMetrics(runTime, "BackPressureTopo", topoConf, getTopology(topoConf));
}

代码示例来源:origin: apache/storm

LOG.info("Using topology conf from {} as basis for getting new creds", topologyId);
Map<String, Object> commandLine = Utils.readCommandLineOpts();
List<String> clCreds = (List<String>)commandLine.get(Config.TOPOLOGY_AUTO_CREDENTIALS);
List<String> topoCreds = (List<String>)topologyConf.get(Config.TOPOLOGY_AUTO_CREDENTIALS);

代码示例来源:origin: apache/storm

fullConf.putAll(Utils.readCommandLineOpts());
fullConf.putAll(conf);
conf = fullConf;

代码示例来源:origin: apache/storm

/**
   * ConstSpout only topology  (No bolts)
   */
  public static void main(String[] args) throws Exception {
    int runTime = -1;
    Config topoConf = new Config();
    if (args.length > 0) {
      runTime = Integer.parseInt(args[0]);
    }
    if (args.length > 1) {
      topoConf.putAll(Utils.findAndReadConfigFile(args[1]));
    }
    topoConf.put(Config.TOPOLOGY_SPOUT_RECVQ_SKIPS, 8);
    topoConf.put(Config.TOPOLOGY_DISABLE_LOADAWARE_MESSAGING, true);
    topoConf.put(Config.TOPOLOGY_STATS_SAMPLE_RATE, 0.0005);
    topoConf.putAll(Utils.readCommandLineOpts());
    if (args.length > 2) {
      System.err.println("args: [runDurationSec]  [optionalConfFile]");
      return;
    }
    //  Submit topology to storm cluster
    Helper.runOnClusterAndPrintMetrics(runTime, TOPOLOGY_NAME, topoConf, getTopology());
  }
}

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
    if (args.length != 2) {
      System.err.println("args: runDurationSec topConfFile");
      return;
    }

    final Integer durationSec = Integer.parseInt(args[0]);
    Config topoConf = new Config();
    topoConf.putAll(Utils.findAndReadConfigFile(args[1]));
    topoConf.put(Config.TOPOLOGY_PRODUCER_BATCH_SIZE, 1000);
    topoConf.put(Config.TOPOLOGY_BOLT_WAIT_STRATEGY, "org.apache.storm.policy.WaitStrategyPark");
    topoConf.put(Config.TOPOLOGY_BOLT_WAIT_PARK_MICROSEC, 0);
    topoConf.put(Config.TOPOLOGY_DISABLE_LOADAWARE_MESSAGING, true);
    topoConf.put(Config.TOPOLOGY_STATS_SAMPLE_RATE, 0.0005);

    topoConf.putAll(Utils.readCommandLineOpts());
    // Submit to Storm cluster
    Helper.runOnClusterAndPrintMetrics(durationSec, TOPOLOGY_NAME, topoConf, getTopology(topoConf));
  }
}

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
    int runTime = -1;
    Config topoConf = new Config();
    if (args.length > 0) {
      runTime = Integer.parseInt(args[0]);
    }
    if (args.length > 1) {
      topoConf.putAll(Utils.findAndReadConfigFile(args[1]));
    }
    topoConf.put(Config.TOPOLOGY_PRODUCER_BATCH_SIZE, 1000);
    topoConf.put(Config.TOPOLOGY_BOLT_WAIT_STRATEGY, "org.apache.storm.policy.WaitStrategyPark");
    topoConf.put(Config.TOPOLOGY_BOLT_WAIT_PARK_MICROSEC, 0);
    topoConf.put(Config.TOPOLOGY_DISABLE_LOADAWARE_MESSAGING, true);
    topoConf.put(Config.TOPOLOGY_STATS_SAMPLE_RATE, 0.0005);

    topoConf.putAll(Utils.readCommandLineOpts());
    if (args.length > 2) {
      System.err.println("args: [runDurationSec]  [optionalConfFile]");
      return;
    }
    //  Submit topology to storm cluster
    Helper.runOnClusterAndPrintMetrics(runTime, TOPOLOGY_NAME, topoConf, getTopology(topoConf));
  }
}

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
    int runTime = -1;
    Config topoConf = new Config();
    if (args.length > 2) {
      String file = args[0];
      runTime = Integer.parseInt(args[1]);
      topoConf.put(INPUT_FILE, file);
      topoConf.putAll(Utils.findAndReadConfigFile(args[1]));
    }
    if (args.length > 3 || args.length == 0) {
      System.err.println("args: file.txt [runDurationSec]  [optionalConfFile]");
      return;
    }
    topoConf.put(Config.TOPOLOGY_SPOUT_RECVQ_SKIPS, 8);
    topoConf.put(Config.TOPOLOGY_PRODUCER_BATCH_SIZE, 1000);
    topoConf.put(Config.TOPOLOGY_DISABLE_LOADAWARE_MESSAGING, true);
    topoConf.put(Config.TOPOLOGY_STATS_SAMPLE_RATE, 0.0005);
    topoConf.put(Config.TOPOLOGY_BOLT_WAIT_STRATEGY, "org.apache.storm.policy.WaitStrategyPark");
    topoConf.put(Config.TOPOLOGY_BOLT_WAIT_PARK_MICROSEC, 0);

    topoConf.putAll(Utils.readCommandLineOpts());
    //  Submit topology to storm cluster
    Helper.runOnClusterAndPrintMetrics(runTime, TOPOLOGY_NAME, topoConf, getTopology(topoConf));
  }
}

代码示例来源:origin: apache/storm

topoConf.putAll(Utils.readCommandLineOpts());
Map<String, Object> conf = Utils.readStormConfig();
conf.putAll(topoConf);

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("spout", new InOrderSpout(), 8);
  builder.setBolt("count", new Check(), 8).fieldsGrouping("spout", new Fields("c1"));
  Config conf = new Config();
  conf.registerMetricsConsumer(org.apache.storm.metric.LoggingMetricsConsumer.class);
  String name = "in-order-test";
  if (args != null && args.length > 0) {
    name = args[0];
  }
  conf.setNumWorkers(1);
  StormSubmitter.submitTopologyWithProgressBar(name, conf, builder.createTopology());
  Map<String, Object> clusterConf = Utils.readStormConfig();
  clusterConf.putAll(Utils.readCommandLineOpts());
  Nimbus.Iface client = NimbusClient.getConfiguredClient(clusterConf).getClient();
  //Sleep for 50 mins
  for (int i = 0; i < 50; i++) {
    Thread.sleep(30 * 1000);
    printMetrics(client, name);
  }
  kill(client, name);
}

代码示例来源:origin: apache/storm

public static void main(String[] args) throws Exception {
  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("spout", new FastRandomSentenceSpout(), 4);
  builder.setBolt("split", new SplitSentence(), 4).shuffleGrouping("spout");
  builder.setBolt("count", new WordCount(), 4).fieldsGrouping("split", new Fields("word"));
  Config conf = new Config();
  conf.registerMetricsConsumer(org.apache.storm.metric.LoggingMetricsConsumer.class);
  String name = "wc-test";
  if (args != null && args.length > 0) {
    name = args[0];
  }
  conf.setNumWorkers(1);
  StormSubmitter.submitTopologyWithProgressBar(name, conf, builder.createTopology());
  Map<String, Object> clusterConf = Utils.readStormConfig();
  clusterConf.putAll(Utils.readCommandLineOpts());
  Nimbus.Iface client = NimbusClient.getConfiguredClient(clusterConf).getClient();
  //Sleep for 5 mins
  for (int i = 0; i < 10; i++) {
    Thread.sleep(30 * 1000);
    printMetrics(client, name);
  }
  kill(client, name);
}

代码示例来源:origin: apache/metron

private void readGlobalTimeoutConfigs() {
 Map stormConf = readStormConfigWithoutCLI();
 Map cliConf   = Utils.readCommandLineOpts();
 //parameter TOPOLOGY_MESSAGE_TIMEOUT_SECS is declared @isInteger and @NotNull in storm-core (org.apache.storm.Config)
 baseMessageTimeoutSecs =
     (Integer) stormConf.getOrDefault(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 0);
 cliMessageTimeoutSecs =
     (Integer)   cliConf.getOrDefault(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 0);
 //parameter TOPOLOGY_TICK_TUPLE_FREQ_SECS is only declared @isInteger, and may in fact return null
 Object scratch;
 scratch = stormConf.getOrDefault(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 0);
 baseTickTupleFreqSecs = (scratch == null) ? 0 : (Integer) scratch;
 scratch =   cliConf.getOrDefault(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 0);
 cliTickTupleFreqSecs  = (scratch == null) ? 0 : (Integer) scratch;
}

代码示例来源:origin: org.apache.storm/storm-core

public static Map<String, Object> readStormConfig() {
  Map<String, Object> ret = readDefaultConfig();
  String confFile = System.getProperty("storm.conf.file");
  Map<String, Object> storm;
  if (confFile == null || confFile.equals("")) {
    storm = findAndReadConfigFile("storm.yaml", false);
  } else {
    storm = findAndReadConfigFile(confFile, true);
  }
  ret.putAll(storm);
  ret.putAll(readCommandLineOpts());
  return ret;
}

代码示例来源:origin: yahoo/storm-yarn

ret.putAll(Utils.readCommandLineOpts());
return ret;

代码示例来源:origin: org.apache.storm/storm-core

throws AuthorizationException, NotAliveException, InvalidTopologyException {
stormConf = new HashMap(stormConf);
stormConf.putAll(Utils.readCommandLineOpts());
Map conf = Utils.readStormConfig();
conf.putAll(stormConf);

相关文章

Utils类方法