[ 
https://issues.apache.org/jira/browse/STORM-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15198136#comment-15198136
 ] 

ASF GitHub Bot commented on STORM-1616:
---------------------------------------

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

    https://github.com/apache/storm/pull/1199#discussion_r56413444
  
    --- Diff: storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java 
---
    @@ -431,6 +454,64 @@ public StormTopology build() {
             
             return builder.buildTopology();
         }
    +
    +    private static Map<String, Number> mergeDefaultResources(Map<String, 
Number> res, Map defaultConfig) {
    +        Map<String, Number> ret = new HashMap<String, Number>();
    +
    +        Number onHeapDefault = 
(Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB);
    +        Number offHeapDefault = 
(Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB);
    +        Number cpuLoadDefault = 
(Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT);
    +
    +        if(res == null) {
    +            ret.put(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB, 
onHeapDefault);
    +            ret.put(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB, 
offHeapDefault);
    +            ret.put(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT, 
cpuLoadDefault);
    +            return ret;
    +        }
    +
    +        Number onHeap = 
res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB);
    +        Number offHeap = 
res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB);
    +        Number cpuLoad = 
res.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT);
    +
    +        /* We take the max of the default and whatever the user put in 
here.
    +           Each node's resources can be the sum of several operations, so 
the simplest
    +           thing to do is get the max.
    +
    +           The situation we want to avoid is that the user sets low 
resources on one
    +           node, and when that node is combined with a bunch of others, 
the sum is still
    +           that low resource count. If any component isn't set, we want to 
use the default.
    +
    +           Right now, this code does not check that. It just takes the max 
of the summed
    +           up resource counts for simplicity's sake. We could perform some 
more complicated
    +           logic to be more accurate, but the benefits are very small, and 
only apply to some
    +           very odd corner cases. */g
    --- End diff --
    
    Comment is OK, but there is a dangling `g` after comment.


> Add RAS API for Trident
> -----------------------
>
>                 Key: STORM-1616
>                 URL: https://issues.apache.org/jira/browse/STORM-1616
>             Project: Apache Storm
>          Issue Type: Bug
>            Reporter: Kyle Nusbaum
>            Assignee: Kyle Nusbaum
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to