/** * Convert to a JSON string * @return a JSON string description */ public String toJson() throws IOException, JsonGenerationException, JsonMappingException { return confTree.toJson(); }
/** * Convert to a JSON string * @return a JSON string description */ public String toJson() throws IOException, JsonGenerationException, JsonMappingException { return confTree.toJson(); }
@Override public String toString() { try { return toJson(); } catch (Exception e) { log.warn("Failed to convert to JSON ", e); return super.toString(); } }
@Override public String toString() { try { return toJson(); } catch (Exception e) { log.warn("Failed to convert to JSON ", e); return super.toString(); } }
@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(); }
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()); } }
@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(); }
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()); } }
/** * Flex operation * @param resources new resources * @return the response * @throws IOException */ public boolean flex(ConfTree resources) throws IOException { Messages.FlexClusterRequestProto request = Messages.FlexClusterRequestProto.newBuilder() .setClusterSpec(resources.toJson()) .build(); Messages.FlexClusterResponseProto response = appMaster.flexCluster(request); return response.getResponse(); }
/** * Flex operation * @param resources new resources * @return the response * @throws IOException */ public boolean flex(ConfTree resources) throws IOException { Messages.FlexClusterRequestProto request = Messages.FlexClusterRequestProto.newBuilder() .setClusterSpec(resources.toJson()) .build(); Messages.FlexClusterResponseProto response = appMaster.flexCluster(request); return response.getResponse(); }