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

    https://github.com/apache/twill/pull/14#discussion_r86288445
  
    --- Diff: 
twill-yarn/src/main/java/org/apache/twill/internal/appmaster/RunningContainers.java
 ---
    @@ -575,18 +601,74 @@ private boolean removeContainerInfo(String 
containerId) {
         return false;
       }
     
    +  private Map<String, Map<String, LogEntry.Level>> 
copyLogLevels(Map<String, Map<String, LogEntry.Level>> originalMap) {
    +    Map<String, Map<String, LogEntry.Level>> result = new TreeMap<>();
    +    for (Map.Entry<String, Map<String, LogEntry.Level>> entry : 
originalMap.entrySet()) {
    +      Map<String, LogEntry.Level> value = new TreeMap<>();
    +      for (Map.Entry<String, LogEntry.Level> valueEntry : 
entry.getValue().entrySet()) {
    +        value.put(valueEntry.getKey(), valueEntry.getValue());
    +      }
    +      result.put(entry.getKey(), value);
    +    }
    +    return result;
    +  }
    +
    +  private void checkAndSetLogLevels(Message message, String runnableName) {
    +    if (message.getType() != Message.Type.SYSTEM
    +      || 
!SystemMessages.LOG_LEVEL.equals(message.getCommand().getCommand())) {
    +      return;
    +    }
    +
    +    Map<String, LogEntry.Level> runnableLogLevels = 
convertLogLevelValuesToLogEntry(message.getCommand().getOptions());
    +    if (!logLevels.containsKey(runnableName)) {
    +      logLevels.put(runnableName, runnableLogLevels);
    +    } else {
    +      logLevels.get(runnableName).putAll(runnableLogLevels);
    +    }
    +  }
    +
    +  private Location saveLogLevels() {
    --- End diff --
    
    We save the log levels to file because we have no way to know if there is 
message about log level change come before the launch of some containers(this 
can happen when we change instance count or restart the container). So when a 
message about log level change come, we will have it stored in the Map in 
`RunningContainers`. And if there is a container launch afterwards, we will 
check if there is update in the log levels, and localize it for the container 
if necessary.


---
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