public AggregateConfResource(AggregateConf conf, UriBuilder uriBuilder) { if (uriBuilder != null) { this.href = uriBuilder.build().toASCIIString(); resources = ResourceFactory.createConfTreeResource(conf.getResources(), uriBuilder.clone().path("configurations").path("resources")); internal = ResourceFactory.createConfTreeResource(conf.getInternal(), uriBuilder.clone().path("configurations").path("internal")); appConf = ResourceFactory.createConfTreeResource(conf.getAppConf(), uriBuilder.clone().path("configurations").path("appConf")); initConfMap(); } else { resources = null; internal = null; appConf = null; } }
public AggregateConfResource(AggregateConf conf, UriBuilder uriBuilder) { if (uriBuilder != null) { this.href = uriBuilder.build().toASCIIString(); resources = ResourceFactory.createConfTreeResource(conf.getResources(), uriBuilder.clone().path("configurations").path("resources")); internal = ResourceFactory.createConfTreeResource(conf.getInternal(), uriBuilder.clone().path("configurations").path("internal")); appConf = ResourceFactory.createConfTreeResource(conf.getAppConf(), uriBuilder.clone().path("configurations").path("appConf")); initConfMap(); } else { resources = null; internal = null; appConf = null; } }
/** * Verify that an instance definition is considered valid by the provider * @param instanceDefinition instance definition * @throws SliderException if the configuration is not valid */ public void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs) throws SliderException { super.validateInstanceDefinition(instanceDefinition, fs); // make sure there is no negative entry in the instance count Map<String, Map<String, String>> instanceMap = instanceDefinition.getResources().components; for (Map.Entry<String, Map<String, String>> entry : instanceMap.entrySet()) { MapOperations mapOperations = new MapOperations(entry); int instances = mapOperations.getOptionInt(COMPONENT_INSTANCES, 0); if (instances < 0) { throw new BadClusterStateException( "Component %s has negative instance count: %d", mapOperations.name, instances); } } }
/** * Verify that an instance definition is considered valid by the provider * @param instanceDefinition instance definition * @throws SliderException if the configuration is not valid */ public void validateInstanceDefinition(AggregateConf instanceDefinition, SliderFileSystem fs) throws SliderException { super.validateInstanceDefinition(instanceDefinition, fs); // make sure there is no negative entry in the instance count Map<String, Map<String, String>> instanceMap = instanceDefinition.getResources().components; for (Map.Entry<String, Map<String, String>> entry : instanceMap.entrySet()) { MapOperations mapOperations = new MapOperations(entry); int instances = mapOperations.getOptionInt(COMPONENT_INSTANCES, 0); if (instances < 0) { throw new BadClusterStateException( "Component %s has negative instance count: %d", mapOperations.name, instances); } } }
private void saveConf(AggregateConf conf) throws IOException { confTreeSerDeser.save(fileSystem, internal, conf.getInternal(), true); confTreeSerDeser.save(fileSystem, resources, conf.getResources(), true); confTreeSerDeser.save(fileSystem, app_conf, conf.getAppConf(), true); }
@Override public ConfTree refresh() throws Exception { AggregateConf aggregateConf = unresolved ? state.getUnresolvedInstanceDefinition(): state.getInstanceDefinitionSnapshot(); ConfTree ct = resources ? aggregateConf.getResources() : aggregateConf.getAppConf(); return new ConfTreeSerDeser().fromInstance(ct); } }
@Override public ConfTree refresh() throws Exception { AggregateConf aggregateConf = unresolved ? state.getUnresolvedInstanceDefinition(): state.getInstanceDefinitionSnapshot(); ConfTree ct = resources ? aggregateConf.getResources() : aggregateConf.getAppConf(); return new ConfTreeSerDeser().fromInstance(ct); } }
@Override // ProviderCompleted public void eventCallbackEvent(Object parameter) { // signalled that the child process is up. appState.noteAMLive(); // now ask for the cluster nodes try { flexCluster(getInstanceDefinition().getResources()); } catch (Exception e) { // cluster flex failure: log log.error("Failed to flex cluster nodes: {}", e, e); // then what? exit ActionStopSlider stopSlider = new ActionStopSlider(e); stopSlider.setExitReason(SliderExitReason.SLIDER_AM_ERROR); queue(stopSlider); } }
private void saveConf(AggregateConf conf) throws IOException { confTreeSerDeser.save(fileSystem, internal, conf.getInternal(), true); confTreeSerDeser.save(fileSystem, resources, conf.getResources(), true); confTreeSerDeser.save(fileSystem, app_conf, conf.getAppConf(), true); }
@Override // ProviderCompleted public void eventCallbackEvent(Object parameter) { // signalled that the child process is up. appState.noteAMLive(); // now ask for the cluster nodes try { flexCluster(getInstanceDefinition().getResources()); } catch (Exception e) { // cluster flex failure: log log.error("Failed to flex cluster nodes: {}", e, e); // then what? exit ActionStopSlider stopSlider = new ActionStopSlider(e); stopSlider.setExitReason(SliderExitReason.SLIDER_AM_ERROR); queue(stopSlider); } }
private void actionDiagnosticApplication(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; requireArgumentSet(Arguments.ARG_NAME, clusterName); AggregateConf instanceDefinition = fetchInstanceDefinition(clusterName); String clusterDir = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.APP_ROOT); String pkgTarball = getApplicationDefinitionPath(instanceDefinition.getAppConfOperations()); String runAsUser = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.RUNAS_USER); log.info("The location of the cluster instance directory in HDFS is: {}", clusterDir); log.info("The name of the application package tarball on HDFS is: {}",pkgTarball); log.info("The runas user of the application in the cluster is: {}",runAsUser); if (diagnosticArgs.verbose) { log.info("App config of the application:\n{}", instanceDefinition.getAppConf().toJson()); log.info("Resource config of the application:\n{}", instanceDefinition.getResources().toJson()); } }
private void actionDiagnosticApplication(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; requireArgumentSet(Arguments.ARG_NAME, clusterName); AggregateConf instanceDefinition = fetchInstanceDefinition(clusterName); String clusterDir = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.APP_ROOT); String pkgTarball = getApplicationDefinitionPath(instanceDefinition.getAppConfOperations()); String runAsUser = instanceDefinition.getAppConfOperations() .getGlobalOptions().get(AgentKeys.RUNAS_USER); log.info("The location of the cluster instance directory in HDFS is: {}", clusterDir); log.info("The name of the application package tarball on HDFS is: {}",pkgTarball); log.info("The runas user of the application in the cluster is: {}",runAsUser); if (diagnosticArgs.verbose) { log.info("App config of the application:\n{}", instanceDefinition.getAppConf().toJson()); log.info("Resource config of the application:\n{}", instanceDefinition.getResources().toJson()); } }
/** * Take a snapshot of the configuration * @param instanceDefinition source * @throws IOException marshalling/copying problems */ public AggregateConf(AggregateConf instanceDefinition) throws IOException { ConfTreeOperations resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); ConfTreeOperations appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); ConfTreeOperations internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal()); //build a new aggregate from the snapshots setResources(resourcesSnapshot.confTree); setAppConf(appConfSnapshot.confTree); setInternal(internalsSnapshot.confTree); }
/** * Take a snapshot of the configuration * @param instanceDefinition source * @throws IOException marshalling/copying problems */ public AggregateConf(AggregateConf instanceDefinition) throws IOException { ConfTreeOperations resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); ConfTreeOperations appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); ConfTreeOperations internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal()); //build a new aggregate from the snapshots setResources(resourcesSnapshot.confTree); setAppConf(appConfSnapshot.confTree); setInternal(internalsSnapshot.confTree); }
resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal());
resourcesSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getResources()); appConfSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getAppConf()); internalsSnapshot = ConfTreeOperations.fromInstance(instanceDefinition.getInternal());
@Override public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition( Messages.GetInstanceDefinitionRequestProto request) throws IOException, YarnException { onRpcCall("getinstancedefinition"); String internal; String resources; String app; AggregateConf instanceDefinition = state.getInstanceDefinitionSnapshot(); internal = instanceDefinition.getInternal().toJson(); resources = instanceDefinition.getResources().toJson(); app = instanceDefinition.getAppConf().toJson(); assert internal != null; assert resources != null; assert app != null; log.debug("Generating getInstanceDefinition Response"); Messages.GetInstanceDefinitionResponseProto.Builder builder = Messages.GetInstanceDefinitionResponseProto.newBuilder(); builder.setInternal(internal); builder.setResources(resources); builder.setApplication(app); return builder.build(); }
@Override public Messages.GetInstanceDefinitionResponseProto getInstanceDefinition( Messages.GetInstanceDefinitionRequestProto request) throws IOException, YarnException { onRpcCall("getinstancedefinition"); String internal; String resources; String app; AggregateConf instanceDefinition = state.getInstanceDefinitionSnapshot(); internal = instanceDefinition.getInternal().toJson(); resources = instanceDefinition.getResources().toJson(); app = instanceDefinition.getAppConf().toJson(); assert internal != null; assert resources != null; assert app != null; log.debug("Generating getInstanceDefinition Response"); Messages.GetInstanceDefinitionResponseProto.Builder builder = Messages.GetInstanceDefinitionResponseProto.newBuilder(); builder.setInternal(internal); builder.setResources(resources); builder.setApplication(app); return builder.build(); }
aggregateConf.getAppConf().global); SliderUtils.mergeMapsIgnoreDuplicateKeys(options, aggregateConf.getResources().global); mergeInComponentMap(cd, aggregateConf.getResources());
aggregateConf.getAppConf().global); SliderUtils.mergeMapsIgnoreDuplicateKeys(options, aggregateConf.getResources().global); mergeInComponentMap(cd, aggregateConf.getResources());