Github user arunmahadevan commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1199#discussion_r55870224
  
    --- Diff: storm-core/src/jvm/org/apache/storm/trident/Stream.java ---
    @@ -124,6 +124,31 @@ public Stream parallelismHint(int hint) {
         }
     
         /**
    +     * Sets the CPU Load resource for the current node
    +     */
    +    public Stream setCPULoad(Number load) {
    --- End diff --
    
    Actually naming the operations wherever specific config needs to be applied 
looks cleaner and it separates out the streaming operations from the config 
specification.
    
    ```java
    TridentTopology topo = new TridentTopology();
    TridentState wordCounts = 
        topology.newStream("spout1", spout)
            .name("spout1")
            .each(new Fields("sentence"), new Split(), new Fields("word"))
            .name("split_operation")
            .groupBy(new Fields("word"))
            .persistentAggregate(new MemorymapState.Factory(), new Count(), new 
Fields("count"))
            .name("aggregate");
    ```
    And then
    ```java
    topology.setConfig("spout1", Config.cpuLoad(20).memoryLoad(1024))
                 .setConfig("split_operation", 
Config.cpuLoad(20).memoryLoad(256))
                 .setConfig("aggregate", Config.parallelismHint(6));
    ```
    The concern with directly adding each config api in Stream is that we might 
want to add more configs in future and then it would mess up the Stream api.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to