/** * Is this app package versioned? * * @return true if {@link SliderKeys#APP_VERSION} was set in the app config * provided during creation of this app * @since 0.80.0-incubating */ public boolean isVersioned() { return StringUtils.isNotEmpty(getAppConfOperations().getGlobalOptions() .get(SliderKeys.APP_VERSION)); }
private void propagatePythonExecutable(Configuration config, AggregateConf instanceDefinition) { String pythonExec = config.get( PYTHON_EXECUTABLE_PATH); if (pythonExec != null) { instanceDefinition.getAppConfOperations().getGlobalOptions().putIfUnset( PYTHON_EXECUTABLE_PATH, pythonExec); } }
/** * Is this app package versioned? * * @return true if {@link SliderKeys#APP_VERSION} was set in the app config * provided during creation of this app * @since 0.80.0-incubating */ public boolean isVersioned() { return StringUtils.isNotEmpty(getAppConfOperations().getGlobalOptions() .get(SliderKeys.APP_VERSION)); }
/** * Merge in another tree with overwrites * @param that the other tree */ public void merge(ConfTree that) { getGlobalOptions().putAll(that.global); confTree.metadata.putAll(that.metadata); confTree.credentials.putAll(that.credentials); for (Map.Entry<String, Map<String, String>> entry : that.components.entrySet()) { MapOperations comp = getOrAddComponent(entry.getKey()); comp.putAll(entry.getValue()); } }
private void propagatePythonExecutable(Configuration config, AggregateConf instanceDefinition) { String pythonExec = config.get( PYTHON_EXECUTABLE_PATH); if (pythonExec != null) { instanceDefinition.getAppConfOperations().getGlobalOptions().putIfUnset( PYTHON_EXECUTABLE_PATH, pythonExec); } }
/** * Merge in another tree with overwrites * @param that the other tree */ public void merge(ConfTree that) { getGlobalOptions().putAll(that.global); confTree.metadata.putAll(that.metadata); confTree.credentials.putAll(that.credentials); for (Map.Entry<String, Map<String, String>> entry : that.components.entrySet()) { MapOperations comp = getOrAddComponent(entry.getKey()); comp.putAll(entry.getValue()); } }
/** * Merge in another tree -no overwrites of global or conf data * (note that metadata does a naive putAll merge/overwrite) * @param that the other tree */ public void mergeWithoutOverwrite(ConfTree that) { getGlobalOptions().mergeWithoutOverwrite(that.global); confTree.metadata.putAll(that.metadata); confTree.credentials.putAll(that.credentials); for (Map.Entry<String, Map<String, String>> entry : that.components.entrySet()) { MapOperations comp = getOrAddComponent(entry.getKey()); comp.mergeWithoutOverwrite(entry.getValue()); } }
/** * Merge in another tree -no overwrites of global or conf data * (note that metadata does a naive putAll merge/overwrite) * @param that the other tree */ public void mergeWithoutOverwrite(ConfTree that) { getGlobalOptions().mergeWithoutOverwrite(that.global); confTree.metadata.putAll(that.metadata); confTree.credentials.putAll(that.credentials); for (Map.Entry<String, Map<String, String>> entry : that.components.entrySet()) { MapOperations comp = getOrAddComponent(entry.getKey()); comp.mergeWithoutOverwrite(entry.getValue()); } }
protected void validateGlobalProperties(ConfTreeOperations props) throws BadConfigException { for (String key : props.getGlobalOptions().keySet()) { validatePropertyNamePrefix(key); } } }
/** * Get the global internal options for the AM * @return a map to access the internals */ public MapOperations getGlobalInternalOptions() { return getInstanceDefinition() .getInternalOperations(). getGlobalOptions(); }
protected void validateGlobalProperties(ConfTreeOperations props) throws BadConfigException { for (String key : props.getGlobalOptions().keySet()) { validatePropertyNamePrefix(key); } } }
/** * Get the global internal options for the AM * @return a map to access the internals */ public MapOperations getGlobalInternalOptions() { return getInstanceDefinition() .getInternalOperations(). getGlobalOptions(); }
private long getContainerReleaseTimeout() { // Get container release timeout in millis or 0 if the property is not set. // If non-zero then add the agent heartbeat delay time, since it can take up // to that much time for agents to receive the stop command. int timeout = getInstanceDefinition().getAppConfOperations() .getGlobalOptions() .getOptionInt(SliderKeys.APP_CONTAINER_RELEASE_TIMEOUT, 0); if (timeout > 0) { timeout += SliderKeys.APP_CONTAINER_HEARTBEAT_INTERVAL_SEC; } // convert to millis long timeoutInMillis = timeout * 1000l; log.info("Container release timeout in millis = {}", timeoutInMillis); return timeoutInMillis; }
/** * Reads and sets the heartbeat monitoring interval. If bad value is provided then log it and set to default. * * @param instanceDefinition */ private void initializeAgentDebugCommands(AggregateConf instanceDefinition) { String launchParameterStr = instanceDefinition.getAppConfOperations(). getGlobalOptions().getOption(AgentKeys.AGENT_INSTANCE_DEBUG_DATA, ""); agentLaunchParameter = new AgentLaunchParameter(launchParameterStr); }
/** * Reads and sets the heartbeat monitoring interval. If bad value is provided then log it and set to default. * * @param instanceDefinition */ private void initializeAgentDebugCommands(AggregateConf instanceDefinition) { String launchParameterStr = instanceDefinition.getAppConfOperations(). getGlobalOptions().getOption(AgentKeys.AGENT_INSTANCE_DEBUG_DATA, ""); agentLaunchParameter = new AgentLaunchParameter(launchParameterStr); }
/** * Build up the port scanner. This may include setting a port range. */ private void buildPortScanner(AggregateConf instanceDefinition) throws BadConfigException { portScanner = new PortScanner(); String portRange = instanceDefinition. getAppConfOperations().getGlobalOptions(). getOption(SliderKeys.KEY_ALLOWED_PORT_RANGE, "0"); if (!"0".equals(portRange)) { portScanner.setPortRange(portRange); } }
/** * Build up the port scanner. This may include setting a port range. */ private void buildPortScanner(AggregateConf instanceDefinition) throws BadConfigException { portScanner = new PortScanner(); String portRange = instanceDefinition. getAppConfOperations().getGlobalOptions(). getOption(SliderKeys.KEY_ALLOWED_PORT_RANGE, "0"); if (!"0".equals(portRange)) { portScanner.setPortRange(portRange); } }
/** * Schedule the escalation action * @param internal * @throws BadConfigException */ private void scheduleEscalation(ConfTree internal) throws BadConfigException { EscalateOutstandingRequests escalate = new EscalateOutstandingRequests(); ConfTreeOperations ops = new ConfTreeOperations(internal); int seconds = ops.getGlobalOptions().getOptionInt(InternalKeys.ESCALATION_CHECK_INTERVAL, InternalKeys.DEFAULT_ESCALATION_CHECK_INTERVAL); RenewingAction<EscalateOutstandingRequests> renew = new RenewingAction<>( escalate, seconds, seconds, TimeUnit.SECONDS, 0); actionQueues.renewing("escalation", renew); }
@Test public void testParameterParsing() throws IOException { AgentProviderService aps = createAgentProviderService(new Configuration()); AggregateConf aggConf = new AggregateConf(); ConfTreeOperations treeOps = aggConf.getAppConfOperations(); treeOps.getGlobalOptions().put(AgentKeys.SYSTEM_CONFIGS, "core-site,yarn-site, core-site "); List<String> configs = aps.getSystemConfigurationsRequested(treeOps); Assert.assertEquals(2, configs.size()); Assert.assertTrue(configs.contains("core-site")); Assert.assertFalse(configs.contains("bore-site")); }
@Test public void testParameterParsing() throws IOException { AgentProviderService aps = createAgentProviderService(new Configuration()); AggregateConf aggConf = new AggregateConf(); ConfTreeOperations treeOps = aggConf.getAppConfOperations(); treeOps.getGlobalOptions().put(AgentKeys.SYSTEM_CONFIGS, "core-site,yarn-site, core-site "); List<String> configs = aps.getSystemConfigurationsRequested(treeOps); Assert.assertEquals(2, configs.size()); Assert.assertTrue(configs.contains("core-site")); Assert.assertFalse(configs.contains("bore-site")); }