Package backtype.storm.generated

Examples of backtype.storm.generated.StormTopology


        try
        {
            // Create the reader
            ThriftReader thriftIn = new ThriftReader(stream, new ThriftReader.TBaseCreator() {
              @Override public TBase create() {
                return new StormTopology();
              }
            });
           
            // Read objects
            assert thriftIn.hasNext();
            TBase base = thriftIn.read();
            assert base != null;
            StormTopology topology = (StormTopology) base;
            assert topology != null;
           
            return topology;
        }
        finally
View Full Code Here


    }

    public static void main(String[] args) throws Exception
    {
        // Read topology file created by petrelbuilder.
        StormTopology topology = readTopology();

        // Get topology-specific configuration from the JAR.
        Config conf = new Config();
        InputStream stream = ResourceLoader.getResourceAsStream("resources/__topology__.yaml", GenericTopology.class);
        try
View Full Code Here

            IRichSpout spout = _spouts.get(spoutId);
            ComponentCommon common = getComponentCommon(spoutId, spout);
            spoutSpecs.put(spoutId, new SpoutSpec(ComponentObject.serialized_java(Utils.serialize(spout)), common));
           
        }
        return new StormTopology(spoutSpecs,
                                 boltSpecs,
                                 new HashMap<String, StateSpoutSpec>());
    }
View Full Code Here

//                .aggregate(new Count(), new Fields("count"))
                .each(new Fields("str"), new Debug());
       
        LocalCluster cluster = new LocalCluster();
       
        StormTopology topo = topology.build();
       
        cluster.submitTopology("kafkatest", new Config(), topo);
        KillOptions killopts = new KillOptions();
        killopts.set_wait_secs(0);
        Utils.sleep(5000);
View Full Code Here

   *        instead of reading from topology code
   * @return
   */
  public static StormTopology normalizeTopology(Map stormConf,
      StormTopology topology, boolean fromConf) {
    StormTopology ret = topology.deepCopy();

    Map<String, Object> components = ThriftTopologyUtils.getComponents(ret);
    for (Entry<String, Object> entry : components.entrySet()) {
      Object component = entry.getValue();
      String componentName = entry.getKey();
View Full Code Here

   */
  public Set<Integer> worker_output_tasks() {

    ContextMaker context_maker = workerData.getContextMaker();
    Set<Integer> task_ids = workerData.getTaskids();
    StormTopology topology = workerData.getSysTopology();

    Set<Integer> rtn = new HashSet<Integer>();

    for (Integer taskid : task_ids) {
      TopologyContext context = context_maker.makeTopologyContext(
View Full Code Here

      Map<Object, Object> totalStormConf = new HashMap<Object, Object>(
          conf);
      totalStormConf.putAll(stormConf);

      StormTopology normalizedTopology = NimbusUtils.normalizeTopology(
          stormConf, topology, false);

      // this validates the structure of the topology
      Common.validate_basic(normalizedTopology, totalStormConf,
          topologyId);
View Full Code Here

     
      // Copy storm files back to stormdist dir from the tmp dir
      stormDistDir = StormConfig.masterStormdistRoot(conf, topologyId);
        stormTmpDir = StormConfig.masterStormTmpRoot(conf, topologyname);
        FileUtils.copyDirectory(new File(stormTmpDir), new File(stormDistDir));
        StormTopology topology = StormConfig.read_nimbus_topology_code(conf, topologyId);
   
        if (jsonConf != null) {
          // Update stormconf.ser
          Map serConf = StormConfig.read_nimbusTmp_topology_conf(conf, topologyname);
          Map<Object, Object> newSerConf = (Map<Object, Object>) JStormUtils
              .from_json(jsonConf);
                serConf.putAll(newSerConf);
       
                Map<Object, Object> stormConf = NimbusUtils.normalizeConf(conf, serConf,
              topology);

                File stormConfFile = new File(StormConfig.stormconf_path(stormDistDir));
                if (stormConfFile.exists()) stormConfFile.delete();
                FileUtils.writeByteArrayToFile(stormConfFile, Utils.serialize(stormConf));

                // Update stormcode.ser
                StormTopology normalizedTopology = NimbusUtils.normalizeTopology(
              stormConf, topology, true);
                File stormCodeFile = new File(StormConfig.stormcode_path(stormDistDir));
                if (stormCodeFile.exists()) stormCodeFile.delete();
                FileUtils.writeByteArrayToFile(stormCodeFile, Utils.serialize(normalizedTopology));
        }
View Full Code Here

   * @return StormTopology
   */
  @Override
  public StormTopology getTopology(String id) throws NotAliveException,
      TException {
    StormTopology topology = null;
    try {
      StormTopology stormtopology = StormConfig
          .read_nimbus_topology_code(conf, id);
      if (stormtopology == null) {
        throw new TException("topology:" + id + "is null");
      }

View Full Code Here

    // @@@ here exist a little problem,
    // we can directly pass stormConf from Submit method
    Map<Object, Object> stormConf = StormConfig.read_nimbus_topology_conf(
        conf, topologyid);

    StormTopology stopology = StormConfig.read_nimbus_topology_code(conf,
        topologyid);

    // use TreeMap to make task as sequence
    Map<Integer, TaskInfo> rtn = new TreeMap<Integer, TaskInfo>();

    StormTopology topology = Common.system_topology(stormConf, stopology);

    Integer count = 0;
    count = mkTaskMaker(stormConf, topology.get_bolts(), rtn, count);
    count = mkTaskMaker(stormConf, topology.get_spouts(), rtn, count);
    count = mkTaskMaker(stormConf, topology.get_state_spouts(), rtn, count);

    return rtn;
  }
View Full Code Here

TOP

Related Classes of backtype.storm.generated.StormTopology

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.