@Override public TwillPreparer withConfiguration(String runnableName, Map<String, String> config) { getDelegate().withConfiguration(runnableName, config); return this; }
@Override public TwillPreparer withConfiguration(Map<String, String> config) { getDelegate().withConfiguration(config); return this; }
@Override public TwillPreparer withConfiguration(Map<String, String> config) { getDelegate().withConfiguration(config); return this; }
@Override public TwillPreparer withConfiguration(String runnableName, Map<String, String> config) { getDelegate().withConfiguration(runnableName, config); return this; }
/** * Sets the configurations for each service. */ private TwillPreparer prepareServiceConfig(TwillPreparer preparer, Map<String, String> runnableConfigPrefixes) { for (Map.Entry<String, String> entry : runnableConfigPrefixes.entrySet()) { String runnableName = entry.getKey(); String configPrefix = entry.getValue() + "twill."; Map<String, String> config = new HashMap<>(); for (Map.Entry<String, String> confEntry : cConf) { if (confEntry.getKey().startsWith(configPrefix)) { // Get the key that twill recognize, which is prefixed with "twill." String key = confEntry.getKey().substring(entry.getValue().length()); // Special case for jvm options. if ("twill.jvm.opts".equals(key)) { preparer.setJVMOptions(runnableName, confEntry.getValue()); } else { config.put(key, confEntry.getValue()); } } } if (!config.isEmpty()) { preparer.withConfiguration(runnableName, config); } } return preparer; }
/** * Adds a {@link LogHandler} to the {@link TwillPreparer} based on the configuration. */ private void addLogHandler(TwillPreparer twillPreparer, CConfiguration cConf) { String confLevel = cConf.get(Constants.COLLECT_APP_CONTAINER_LOG_LEVEL).toUpperCase(); if ("OFF".equals(confLevel)) { twillPreparer.withConfiguration(Collections.singletonMap(Configs.Keys.LOG_COLLECTION_ENABLED, "false")); return; } LogEntry.Level logLevel = LogEntry.Level.ERROR; try { logLevel = "ALL".equals(confLevel) ? LogEntry.Level.TRACE : LogEntry.Level.valueOf(confLevel.toUpperCase()); } catch (Exception e) { LOG.warn("Invalid application container log level {}. Defaulting to ERROR.", confLevel); } twillPreparer.addLogHandler(new LoggerLogHandler(LOG, logLevel)); }
/** * Adds a {@link LogHandler} to the {@link TwillPreparer} based on the configuration. */ private void addLogHandler(TwillPreparer twillPreparer, CConfiguration cConf) { String confLevel = cConf.get(Constants.COLLECT_APP_CONTAINER_LOG_LEVEL).toUpperCase(); if ("OFF".equals(confLevel)) { twillPreparer.withConfiguration(Collections.singletonMap(Configs.Keys.LOG_COLLECTION_ENABLED, "false")); return; } LogEntry.Level logLevel = LogEntry.Level.ERROR; try { logLevel = "ALL".equals(confLevel) ? LogEntry.Level.TRACE : LogEntry.Level.valueOf(confLevel.toUpperCase()); } catch (Exception e) { LOG.warn("Invalid application container log level {}. Defaulting to ERROR.", confLevel); } twillPreparer.addLogHandler(new LoggerLogHandler(LOG, logLevel)); }
preparer.withConfiguration(twillConfigs);
.withConfiguration(Collections.singletonMap(Configs.Keys.LOG_COLLECTION_ENABLED, "false")) .addLogHandler(new LogHandler() { @Override
twillPreparer.withConfiguration(twillConfigs); twillPreparer.withConfiguration(runnable, runnableDefinition.getTwillRunnableConfigs());
twillPreparer.withConfiguration(twillConfigs); twillPreparer.withConfiguration(runnable, runnableDefinition.getTwillRunnableConfigs());
.withConfiguration(ImmutableMap.of(Configs.Keys.YARN_AM_MEMORY_MB, "256", Configs.Keys.HEAP_RESERVED_MIN_RATIO, "0.65")) .withConfiguration("sleep", ImmutableMap.of(Configs.Keys.HEAP_RESERVED_MIN_RATIO, "0.8", Configs.Keys.JAVA_RESERVED_MEMORY_MB, "1024"))