本文整理了Java中org.springframework.yarn.boot.app.YarnContainerClusterApplication
类的一些代码示例,展示了YarnContainerClusterApplication
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnContainerClusterApplication
类的具体详情如下:
包路径:org.springframework.yarn.boot.app.YarnContainerClusterApplication
类名称:YarnContainerClusterApplication
[英]A Boot application which is used to control Spring YARN ContainerClusters via rest API offered by a YarnContainerClusterMvcEndpoint.
[中]一个引导应用程序,用于通过YarnContainerClusterMVC端点提供的rest API控制Spring纱线容器集群。
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-module-deployer-yarn
@Override
public void startCluster(String yarnApplicationId, String clusterId) {
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty(PREFIX_CCA + "operation", "CLUSTERSTART");
appProperties.setProperty(PREFIX_CCA + "applicationId", yarnApplicationId);
appProperties.setProperty(PREFIX_CCA + "clusterId", clusterId);
app.appProperties(appProperties);
String output = runApp(app);
logger.debug("Output from YarnContainerClusterApplication run for CLUSTERSTART: {}", output);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClusterDestroy(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
operations.clusterDestroy(clusterId);
return "Cluster " + clusterId + " destroyed.";
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
public String run() {
return run(new String[0]);
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-module-deployer-yarn
@Override
public void stopCluster(String yarnApplicationId, String clusterId) {
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty(PREFIX_CCA + "operation", "CLUSTERSTOP");
appProperties.setProperty(PREFIX_CCA + "applicationId", yarnApplicationId);
appProperties.setProperty(PREFIX_CCA + "clusterId", clusterId);
app.appProperties(appProperties);
String output = runApp(app);
logger.debug("Output from YarnContainerClusterApplication run for CLUSTERSTOP: {}", output);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClusterStart(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
ContainerClusterModifyRequest request = new ContainerClusterModifyRequest();
request.setAction("start");
operations.clusterStart(clusterId, request);
return "Cluster " + clusterId + " started.";
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-module-deployer-yarn
@Override
public void destroyCluster(String yarnApplicationId, String clusterId) {
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty(PREFIX_CCA + "operation", "CLUSTERDESTROY");
appProperties.setProperty(PREFIX_CCA + "applicationId", yarnApplicationId);
appProperties.setProperty(PREFIX_CCA + "clusterId", clusterId);
app.appProperties(appProperties);
String output = runApp(app);
logger.debug("Output from YarnContainerClusterApplication run for CLUSTERDESTROY: {}", output);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClusterStop(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
ContainerClusterModifyRequest request = new ContainerClusterModifyRequest();
request.setAction("stop");
operations.clusterStop(clusterId, request);
return "Cluster " + clusterId + " stopped.";
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli
@Override
protected void runApplication(OptionSet options) throws Exception {
String appId = options.valueOf(applicationIdOption);
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERSINFO");
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.applicationId",
appId);
app.appProperties(appProperties);
handleApplicationRun(app);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClustersInfo(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
YarnContainerClusterEndpointResource response = operations.getClusters();
return ContainerClusterReport.clustersInfoReportBuilder()
.add(ClustersInfoField.ID)
.from(new ArrayList<String>(response.getClusters()))
.build().toString();
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli
@Override
protected void runApplication(OptionSet options) throws Exception {
String appId = options.valueOf(applicationIdOption);
String versionId = options.valueOf(clusterIdOption);
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERDESTROY");
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.applicationId",
appId);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.clusterId",
versionId);
app.appProperties(appProperties);
handleApplicationRun(app);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClusterModify(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId,
Integer projectionDataAny, Map<String, Integer> hosts, Map<String, Integer> racks,
Map<String, Object> properties) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
ContainerClusterCreateRequest request = new ContainerClusterCreateRequest();
request.setClusterId(clusterId);
ProjectionDataType projectionData = new ProjectionDataType();
projectionData.setAny(projectionDataAny);
projectionData.setHosts(hosts);
projectionData.setRacks(racks);
projectionData.setProperties(properties);
request.setProjectionData(projectionData);
operations.clusterModify(clusterId, request);
return "Cluster " + clusterId + " modified.";
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-module-deployer-yarn
@Override
public Collection<String> getClusters(String yarnApplicationId) {
ArrayList<String> clusters = new ArrayList<String>();
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty(PREFIX_CCA + "operation", "CLUSTERSINFO");
appProperties.setProperty(PREFIX_CCA + "applicationId", yarnApplicationId);
app.appProperties(appProperties);
try {
String output = runApp(app);
logger.debug("Output from YarnContainerClusterApplication run for CLUSTERSINFO: {}", output);
String[] lines = output.split("\\r?\\n");
for (int i = 2; i < lines.length; i++) {
String[] fields = lines[i].trim().split("\\s+");
clusters.add(fields[0]);
}
} catch (Exception e) {
logger.warn("CLUSTERSINFO resulted an error", e);
}
return clusters;
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClusterCreate(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId, String clusterDef,
String projectionType, Integer projectionDataAny, Map<String, Integer> hosts, Map<String, Integer> racks,
Map<String, Object> projectionDataProperties, Map<String, Object> extraProperties) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
ContainerClusterCreateRequest request = new ContainerClusterCreateRequest();
request.setClusterId(clusterId);
request.setClusterDef(clusterDef);
request.setProjection(projectionType);
request.setExtraProperties(extraProperties);
ProjectionDataType projectionData = new ProjectionDataType();
projectionData.setAny(projectionDataAny);
projectionData.setHosts(hosts);
projectionData.setRacks(racks);
projectionData.setProperties(projectionDataProperties);
request.setProjectionData(projectionData);
operations.clusterCreate(request);
return "Cluster " + clusterId + " created.";
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-module-deployer-yarn
@Override
public void createCluster(String yarnApplicationId, String clusterId, int count, String module,
Map<String, String> definitionParameters) {
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty(PREFIX_CCA + "operation", "CLUSTERCREATE");
appProperties.setProperty(PREFIX_CCA + "applicationId", yarnApplicationId);
appProperties.setProperty(PREFIX_CCA + "clusterId", clusterId);
appProperties.setProperty(PREFIX_CCA + "clusterDef", "module-template");
appProperties.setProperty(PREFIX_CCA + "projectionType", "default");
appProperties.setProperty(PREFIX_CCA + "projectionData.any", Integer.toString(count));
appProperties.setProperty(PREFIX_CCA + "extraProperties.containerModules", module);
int i = 0;
for (Map.Entry<String, String> entry : definitionParameters.entrySet()) {
appProperties.setProperty(PREFIX_CCA + "extraProperties.containerArg" + i++ ,
entry.getKey() + "=" + entry.getValue());
}
app.appProperties(appProperties);
String output = runApp(app);
logger.debug("Output from YarnContainerClusterApplication run for CLUSTERCREATE: {}", output);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot
private String doClusterInfo(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId, boolean verbose) {
YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId);
ContainerClusterResource response = operations.clusterInfo(clusterId);
代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli
@Override
protected void runApplication(OptionSet options) throws Exception {
String appId = options.valueOf(applicationIdOption);
String clusterId = options.valueOf(clusterIdOption);
Assert.state(StringUtils.hasText(appId) && StringUtils.hasText(clusterId), "Cluster Id and Application Id must be defined");
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERSTOP");
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.applicationId",
appId);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.clusterId",
clusterId);
app.appProperties(appProperties);
handleApplicationRun(app);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli
@Override
protected void runApplication(OptionSet options) throws Exception {
String appId = options.valueOf(applicationIdOption);
String clusterId = options.valueOf(clusterIdOption);
Assert.state(StringUtils.hasText(appId) && StringUtils.hasText(clusterId), "Cluster Id and Application Id must be defined");
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERSTART");
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.applicationId",
appId);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.clusterId",
clusterId);
app.appProperties(appProperties);
handleApplicationRun(app);
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-dataflow-module-deployer-yarn
private Map<String, String> getInstanceClustersStates(String yarnApplicationId, String clusterId) {
HashMap<String, String> states = new HashMap<String, String>();
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty(PREFIX_CCA + "operation", "CLUSTERINFO");
appProperties.setProperty(PREFIX_CCA + "applicationId", yarnApplicationId);
appProperties.setProperty(PREFIX_CCA + "verbose", "false");
appProperties.setProperty(PREFIX_CCA + "clusterId", clusterId);
app.appProperties(appProperties);
try {
String output = runApp(app);
logger.debug("Output from YarnContainerClusterApplication run for CLUSTERINFO: {}", output);
String[] lines = output.trim().split("\\r?\\n");
if (lines.length == 3) {
String[] fields = lines[2].trim().split("\\s+");
states.put(clusterId, fields[0].trim());
}
}
catch (Exception e) {
logger.warn("CLUSTERINFO resulted an error", e);
}
return states;
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli
@Override
protected void runApplication(OptionSet options) throws Exception {
String appId = options.valueOf(applicationIdOption);
String clusterId = options.valueOf(clusterIdOption);
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERINFO");
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.applicationId",
appId);
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.clusterId",
clusterId);
if (isFlagOn(options, verboseOption)) {
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.verbose", "true");
}
app.appProperties(appProperties);
handleApplicationRun(app);
}
代码示例来源:origin: org.springframework.data/spring-yarn-boot-cli
String projectionRaw = options.valueOf(projectionDataRawOption);
YarnContainerClusterApplication app = new YarnContainerClusterApplication();
Properties appProperties = new Properties();
appProperties.setProperty("spring.yarn.internal.ContainerClusterApplication.operation", "CLUSTERMODIFY");
app.appProperties(appProperties);
handleApplicationRun(app);
内容来源于网络,如有侵权,请联系作者删除!