@VisibleForTesting protected List<String> getSystemConfigurationsRequested(ConfTreeOperations appConf) { List<String> configList = new ArrayList<String>(); String configTypes = appConf.get(AgentKeys.SYSTEM_CONFIGS); if (configTypes != null && configTypes.length() > 0) { String[] configs = configTypes.split(","); for (String config : configs) { configList.add(config.trim()); } } return new ArrayList<String>(new HashSet<String>(configList)); }
private Map<String, String> getStandardTokenMap(ConfTreeOperations appConf, String componentName, String componentGroup) throws SliderException { Map<String, String> tokens = new HashMap<String, String>(); String nnuri = appConf.get("site.fs.defaultFS"); tokens.put("${NN_URI}", nnuri); tokens.put("${NN_HOST}", URI.create(nnuri).getHost()); tokens.put("${ZK_HOST}", appConf.get(OptionKeys.ZOOKEEPER_HOSTS)); tokens.put("${DEFAULT_ZK_PATH}", appConf.get(OptionKeys.ZOOKEEPER_PATH)); String prefix = appConf.getComponentOpt(componentGroup, ROLE_PREFIX, null); .getGlobalOptions() .getMandatoryOption(InternalKeys.INTERNAL_DATA_DIR_PATH) + dataDirSuffix); tokens.put("${JAVA_HOME}", appConf.get(AgentKeys.JAVA_HOME)); tokens.put("${COMPONENT_NAME}", componentName); tokens.put("${COMPONENT_NAME.lc}", componentName.toLowerCase());
if (SliderUtils.isUnset(appHome)) { String agentImage = instanceDefinition.getInternalOperations(). get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); sliderFileSystem.verifyFileExists(new Path(agentImage));
if (SliderUtils.isUnset(appHome)) { String agentImage = instanceDefinition.getInternalOperations(). get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); sliderFileSystem.verifyFileExists(new Path(agentImage));
private Map<String, String> getStandardTokenMap(ConfTreeOperations appConf, String componentName, String componentGroup) throws SliderException { Map<String, String> tokens = new HashMap<String, String>(); String nnuri = appConf.get("site.fs.defaultFS"); tokens.put("${NN_URI}", nnuri); tokens.put("${NN_HOST}", URI.create(nnuri).getHost()); tokens.put("${ZK_HOST}", appConf.get(OptionKeys.ZOOKEEPER_HOSTS)); tokens.put("${DEFAULT_ZK_PATH}", appConf.get(OptionKeys.ZOOKEEPER_PATH)); String prefix = appConf.getComponentOpt(componentGroup, ROLE_PREFIX, null); .getGlobalOptions() .getMandatoryOption(InternalKeys.INTERNAL_DATA_DIR_PATH) + dataDirSuffix); tokens.put("${JAVA_HOME}", appConf.get(AgentKeys.JAVA_HOME)); tokens.put("${COMPONENT_NAME}", componentName); tokens.put("${COMPONENT_NAME.lc}", componentName.toLowerCase());
@VisibleForTesting protected List<String> getSystemConfigurationsRequested(ConfTreeOperations appConf) { List<String> configList = new ArrayList<String>(); String configTypes = appConf.get(AgentKeys.SYSTEM_CONFIGS); if (configTypes != null && configTypes.length() > 0) { String[] configs = configTypes.split(","); for (String config : configs) { configList.add(config.trim()); } } return new ArrayList<String>(new HashSet<String>(configList)); }
@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); }
/** * Build the image dir. This path is relative and only valid at the far end * @param internal internal options * @param bindir bin subdir * @param script script in bin subdir * @return the path to the script * @throws FileNotFoundException if a file is not found, or it is not a directory* */ public String buildPathToScript(ConfTreeOperations internal, String bindir, String script) throws FileNotFoundException { String homedir = buildPathToHomeDir( internal.get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH), internal.get(InternalKeys.INTERNAL_APPLICATION_HOME), bindir, script); return buildScriptPath(bindir, script, homedir); }
cmdStop.setTaskId(taskId.get()); cmdStop.setCommandId(cmdStop.getTaskId() + "-1"); String clusterName = internalsConf.get(OptionKeys.APPLICATION_NAME); String hostName = getClusterInfoPropertyValue(StatusKeys.INFO_AM_HOSTNAME); cmdStop.setHostname(hostName);
/** * Build the image dir. This path is relative and only valid at the far end * @param internal internal options * @param bindir bin subdir * @param script script in bin subdir * @return the path to the script * @throws FileNotFoundException if a file is not found, or it is not a directory* */ public String buildPathToScript(ConfTreeOperations internal, String bindir, String script) throws FileNotFoundException { String homedir = buildPathToHomeDir( internal.get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH), internal.get(InternalKeys.INTERNAL_APPLICATION_HOME), bindir, script); return buildScriptPath(bindir, script, homedir); }
@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); }
private String getClusterName() { if (SliderUtils.isUnset(clusterName)) { clusterName = getAmState().getInternalsSnapshot().get(OptionKeys.APPLICATION_NAME); } return clusterName; }
cmdStop.setTaskId(taskId.get()); cmdStop.setCommandId(cmdStop.getTaskId() + "-1"); String clusterName = internalsConf.get(OptionKeys.APPLICATION_NAME); String hostName = getClusterInfoPropertyValue(StatusKeys.INFO_AM_HOSTNAME); cmdStop.setHostname(hostName);
private String getClusterName() { if (SliderUtils.isUnset(clusterName)) { clusterName = getAmState().getInternalsSnapshot().get(OptionKeys.APPLICATION_NAME); } return clusterName; }
@Override public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem, Configuration serviceConf, AbstractLauncher launcher, AggregateConf instanceDefinition, Path snapshotConfDirPath, Path generatedConfDirPath, Configuration clientConfExtras, String libdir, Path tempPath, boolean miniClusterTestRun) throws IOException, SliderException { String agentImage = instanceDefinition.getInternalOperations(). get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); if (SliderUtils.isUnset(agentImage)) { Path agentPath = new Path(tempPath.getParent(), AgentKeys.PROVIDER_AGENT); log.info("Automatically uploading the agent tarball at {}", agentPath); fileSystem.getFileSystem().mkdirs(agentPath); if (ProviderUtils.addAgentTar(this, AGENT_TAR, fileSystem, agentPath)) { instanceDefinition.getInternalOperations().set( InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, new Path(agentPath, AGENT_TAR).toUri()); } } }
@Override public void prepareAMAndConfigForLaunch(SliderFileSystem fileSystem, Configuration serviceConf, AbstractLauncher launcher, AggregateConf instanceDefinition, Path snapshotConfDirPath, Path generatedConfDirPath, Configuration clientConfExtras, String libdir, Path tempPath, boolean miniClusterTestRun) throws IOException, SliderException { String agentImage = instanceDefinition.getInternalOperations(). get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH); if (SliderUtils.isUnset(agentImage)) { Path agentPath = new Path(tempPath.getParent(), AgentKeys.PROVIDER_AGENT); log.info("Automatically uploading the agent tarball at {}", agentPath); fileSystem.getFileSystem().mkdirs(agentPath); if (ProviderUtils.addAgentTar(this, AGENT_TAR, fileSystem, agentPath)) { instanceDefinition.getInternalOperations().set( InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH, new Path(agentPath, AGENT_TAR).toUri()); } } }
private void actionDiagnosticSlider(ActionDiagnosticArgs diagnosticArgs) throws YarnException, IOException { // not using member variable clustername because we want to place // application name after --application option and member variable // cluster name has to be put behind action String clusterName = diagnosticArgs.name; if(isUnset(clusterName)){ throw new BadCommandArgumentsException("application name must be provided with --name option"); } AggregateConf instanceDefinition = fetchInstanceDefinition(clusterName); String imagePath = instanceDefinition.getInternalOperations().get( INTERNAL_APPLICATION_IMAGE_PATH); // if null, it will be uploaded by Slider and thus at slider's path if (imagePath == null) { ApplicationReport appReport = findInstance(clusterName); if (appReport != null) { Path path1 = sliderFileSystem.getTempPathForCluster(clusterName); Path subPath = new Path(path1, appReport.getApplicationId().toString() + "/agent"); imagePath = subPath.toString(); } } log.info("The path of slider agent tarball on HDFS is: " + imagePath); }
private void actionDiagnosticSlider(ActionDiagnosticArgs diagnosticArgs) throws YarnException, IOException { // not using member variable clustername because we want to place // application name after --application option and member variable // cluster name has to be put behind action String clusterName = diagnosticArgs.name; if(isUnset(clusterName)){ throw new BadCommandArgumentsException("application name must be provided with --name option"); } AggregateConf instanceDefinition = fetchInstanceDefinition(clusterName); String imagePath = instanceDefinition.getInternalOperations().get( INTERNAL_APPLICATION_IMAGE_PATH); // if null, it will be uploaded by Slider and thus at slider's path if (imagePath == null) { ApplicationReport appReport = findInstance(clusterName); if (appReport != null) { Path path1 = sliderFileSystem.getTempPathForCluster(clusterName); Path subPath = new Path(path1, appReport.getApplicationId().toString() + "/agent"); imagePath = subPath.toString(); } } log.info("The path of slider agent tarball on HDFS is: " + imagePath); }
AggregateConf instanceDefinition = clusterOperations .getInstanceDefinition(); String imagePath = instanceDefinition.getInternalOperations().get( INTERNAL_APPLICATION_IMAGE_PATH);
AggregateConf instanceDefinition = clusterOperations .getInstanceDefinition(); String imagePath = instanceDefinition.getInternalOperations().get( INTERNAL_APPLICATION_IMAGE_PATH);