protected Map<String, DefaultConfig> getDefaultConfigs(String roleGroup) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); String mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); return metaInfoMap.get(mapKey).defaultConfigs; }
@VisibleForTesting protected Metainfo getMetaInfo(String roleGroup) { String mapKey = DEFAULT_METAINFO_MAP_KEY; if (roleGroup != null) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); } MetainfoHolder mh = this.metaInfoMap.get(mapKey); if (mh == null) { return null; } return mh.metaInfo; }
protected Map<String, DefaultConfig> getDefaultConfigs(String roleGroup) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); String mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); return metaInfoMap.get(mapKey).defaultConfigs; }
@VisibleForTesting protected Metainfo getMetaInfo(String roleGroup) { String mapKey = DEFAULT_METAINFO_MAP_KEY; if (roleGroup != null) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); } MetainfoHolder mh = this.metaInfoMap.get(mapKey); if (mh == null) { return null; } return mh.metaInfo; }
private String getConfigFromMetaInfoWithAppConfigOverriding(String roleGroup, String configName){ ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); String containerName = getApplicationComponent(roleGroup) .getDockerContainers().get(0).getName();
private void publishModifiedExportGroups(Set<String> modifiedGroups) { for (String groupName : modifiedGroups) { Map<String, List<ExportEntry>> entries = this.exportGroups.get(groupName); // Publish in old format for the time being Map<String, String> simpleEntries = new HashMap<String, String>(); for (Map.Entry<String, List<ExportEntry>> entry : entries.entrySet()) { List<ExportEntry> exports = entry.getValue(); if (SliderUtils.isNotEmpty(exports)) { // there is no support for multiple exports per name - so extract only the first one simpleEntries.put(entry.getKey(), entry.getValue().get(0).getValue()); } } if (!getAmState().getAppConfSnapshot().getComponentOptBool( groupName, AgentKeys.AM_CONFIG_GENERATION, false)) { publishApplicationInstanceData(groupName, groupName, simpleEntries.entrySet()); } PublishedExports exports = new PublishedExports(groupName); exports.setUpdated(new Date().getTime()); exports.putValues(entries.entrySet()); getAmState().getPublishedExportsSet().put(groupName, exports); } }
private String getConfigFromMetaInfoWithAppConfigOverriding(String roleGroup, String configName){ ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); String containerName = getApplicationComponent(roleGroup) .getDockerContainers().get(0).getName();
private void publishModifiedExportGroups(Set<String> modifiedGroups) { for (String groupName : modifiedGroups) { Map<String, List<ExportEntry>> entries = this.exportGroups.get(groupName); // Publish in old format for the time being Map<String, String> simpleEntries = new HashMap<String, String>(); for (Map.Entry<String, List<ExportEntry>> entry : entries.entrySet()) { List<ExportEntry> exports = entry.getValue(); if (SliderUtils.isNotEmpty(exports)) { // there is no support for multiple exports per name - so extract only the first one simpleEntries.put(entry.getKey(), entry.getValue().get(0).getValue()); } } if (!getAmState().getAppConfSnapshot().getComponentOptBool( groupName, AgentKeys.AM_CONFIG_GENERATION, false)) { publishApplicationInstanceData(groupName, groupName, simpleEntries.entrySet()); } PublishedExports exports = new PublishedExports(groupName); exports.setUpdated(new Date().getTime()); exports.putValues(entries.entrySet()); getAmState().getPublishedExportsSet().put(groupName, exports); } }
@Override public void bind(StateAccessForProviders stateAccessor, QueueAccess queueAccess, List<Container> liveContainers) { super.bind(stateAccessor, queueAccess, liveContainers); Map<String,String> dummyProps = new HashMap<String, String>(); dummyProps.put("prop1", "val1"); dummyProps.put("prop2", "val2"); log.info("publishing dummy-site.xml with values {}", dummyProps); publishApplicationInstanceData("dummy-site", "dummy configuration", dummyProps.entrySet()); // publishing global config for testing purposes publishApplicationInstanceData("global", "global configuration", stateAccessor.getAppConfSnapshot() .getGlobalOptions().entrySet()); }
@Override public void bind(StateAccessForProviders stateAccessor, QueueAccess queueAccess, List<Container> liveContainers) { super.bind(stateAccessor, queueAccess, liveContainers); Map<String,String> dummyProps = new HashMap<String, String>(); dummyProps.put("prop1", "val1"); dummyProps.put("prop2", "val2"); log.info("publishing dummy-site.xml with values {}", dummyProps); publishApplicationInstanceData("dummy-site", "dummy configuration", dummyProps.entrySet()); // publishing global config for testing purposes publishApplicationInstanceData("global", "global configuration", stateAccessor.getAppConfSnapshot() .getGlobalOptions().entrySet()); }
ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); Map<String, Map<String, String>> configurations = buildCommandConfigurations( appConf, containerId, roleName, roleGroup);
ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); Map<String, Map<String, String>> configurations = buildCommandConfigurations( appConf, containerId, roleName, roleGroup);
throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot();
throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); if (isDockerContainer(roleGroup) || isYarnDockerContainer(roleGroup)) { addStatusDockerCommand(roleName, roleGroup, containerId, response,
treeOps.set(OptionKeys.ZOOKEEPER_HOSTS, "HOST1"); expect(access.getAppConfSnapshot()).andReturn(treeOps).anyTimes(); expect(access.getInternalsSnapshot()).andReturn(treeOps).anyTimes(); expect(access.isApplicationLive()).andReturn(true).anyTimes();
throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); if (isDockerContainer(roleGroup) || isYarnDockerContainer(roleGroup)) { addStatusDockerCommand(roleName, roleGroup, containerId, response,
@VisibleForTesting protected void addUpgradeCommand(String roleName, String roleGroup, String containerId, HeartBeatResponse response, String scriptPath, long timeout) throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); ConfTreeOperations internalsConf = getAmState().getInternalsSnapshot(); ExecutionCommand cmd = new ExecutionCommand( AgentCommandType.EXECUTION_COMMAND); prepareExecutionCommand(cmd); String clusterName = internalsConf.get(OptionKeys.APPLICATION_NAME); String hostName = getClusterInfoPropertyValue(StatusKeys.INFO_AM_HOSTNAME); cmd.setHostname(hostName); cmd.setClusterName(clusterName); cmd.setRoleCommand(Command.UPGRADE.toString()); cmd.setServiceName(clusterName); cmd.setComponentName(roleName); cmd.setRole(roleName); Map<String, String> hostLevelParams = new TreeMap<String, String>(); hostLevelParams.put(JAVA_HOME, appConf.getGlobalOptions() .getMandatoryOption(JAVA_HOME)); hostLevelParams.put(CONTAINER_ID, containerId); cmd.setHostLevelParams(hostLevelParams); cmd.setCommandParams(commandParametersSet(scriptPath, timeout, true)); Map<String, Map<String, String>> configurations = buildCommandConfigurations( appConf, containerId, roleName, roleGroup); cmd.setConfigurations(configurations); response.addExecutionCommand(cmd); }
@VisibleForTesting protected void addUpgradeCommand(String roleName, String roleGroup, String containerId, HeartBeatResponse response, String scriptPath, long timeout) throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); ConfTreeOperations internalsConf = getAmState().getInternalsSnapshot(); ExecutionCommand cmd = new ExecutionCommand( AgentCommandType.EXECUTION_COMMAND); prepareExecutionCommand(cmd); String clusterName = internalsConf.get(OptionKeys.APPLICATION_NAME); String hostName = getClusterInfoPropertyValue(StatusKeys.INFO_AM_HOSTNAME); cmd.setHostname(hostName); cmd.setClusterName(clusterName); cmd.setRoleCommand(Command.UPGRADE.toString()); cmd.setServiceName(clusterName); cmd.setComponentName(roleName); cmd.setRole(roleName); Map<String, String> hostLevelParams = new TreeMap<String, String>(); hostLevelParams.put(JAVA_HOME, appConf.getGlobalOptions() .getMandatoryOption(JAVA_HOME)); hostLevelParams.put(CONTAINER_ID, containerId); cmd.setHostLevelParams(hostLevelParams); cmd.setCommandParams(commandParametersSet(scriptPath, timeout, true)); Map<String, Map<String, String>> configurations = buildCommandConfigurations( appConf, containerId, roleName, roleGroup); cmd.setConfigurations(configurations); response.addExecutionCommand(cmd); }
boolean isInUpgradeMode) throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); ConfTreeOperations internalsConf = getAmState().getInternalsSnapshot();
boolean isInUpgradeMode) throws SliderException { assert getAmState().isApplicationLive(); ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); ConfTreeOperations internalsConf = getAmState().getInternalsSnapshot();