You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2022/12/16 07:01:41 UTC
[kylin] 10/15: KYLIN-5365 given an incorrect query queue, check-1700-spark-kystorage.sh prints the detail error message
This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit e23c37715bd712a3d27a68199bc64e4e280c1f46
Author: huangsheng <hu...@163.com>
AuthorDate: Wed Oct 26 17:13:34 2022 +0800
KYLIN-5365 given an incorrect query queue, check-1700-spark-kystorage.sh prints the detail error message
Co-authored-by: huangsheng <hu...@163.com>
---
.../main/java/org/apache/kylin/tool/setup/KapGetClusterInfo.java | 9 ++++++++-
.../java/org/apache/kylin/tool/setup/YarnResourceInfoTool.java | 5 +++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/tool/src/main/java/org/apache/kylin/tool/setup/KapGetClusterInfo.java b/src/tool/src/main/java/org/apache/kylin/tool/setup/KapGetClusterInfo.java
index 0292dc77ee..d3cf151d59 100644
--- a/src/tool/src/main/java/org/apache/kylin/tool/setup/KapGetClusterInfo.java
+++ b/src/tool/src/main/java/org/apache/kylin/tool/setup/KapGetClusterInfo.java
@@ -111,7 +111,7 @@ public class KapGetClusterInfo {
val patternedLogger = new BufferedLogger(logger);
val response = config.getCliCommandExecutor().execute(command, patternedLogger).getCmd();
logger.info("yarn metrics response: {}", response);
- Map<String, Integer> clusterMetricsInfos;
+ Map<String, Integer> clusterMetricsInfos = null;
if (response == null) {
throw new IllegalStateException(
"Cannot get yarn metrics with url: " + yarnMasterUrlBase + YARN_METRICS_SUFFIX);
@@ -135,6 +135,13 @@ public class KapGetClusterInfo {
} else {
clusterMetricsInfos = yarnClusterMetrics.getYarnResourceInfoByQueueName(this.queueName);
}
+
+ if (clusterMetricsInfos == null || clusterMetricsInfos.isEmpty()) {
+ logger.error("The queue:{} is invalid, please check kylin.properties", this.queueName);
+ Unsafe.systemExit(101);
+ return;
+ }
+
clusterMetricsMap.put(AVAILABLE_VIRTUAL_CORE, clusterMetricsInfos.get(AVAILABLE_VIRTUAL_CORE));
clusterMetricsMap.put(AVAILABLE_MEMORY, clusterMetricsInfos.get(AVAILABLE_MEMORY));
return;
diff --git a/src/tool/src/main/java/org/apache/kylin/tool/setup/YarnResourceInfoTool.java b/src/tool/src/main/java/org/apache/kylin/tool/setup/YarnResourceInfoTool.java
index 3fa65d45eb..33984f9093 100644
--- a/src/tool/src/main/java/org/apache/kylin/tool/setup/YarnResourceInfoTool.java
+++ b/src/tool/src/main/java/org/apache/kylin/tool/setup/YarnResourceInfoTool.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Paths;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -67,6 +68,10 @@ public class YarnResourceInfoTool {
Map<String, Integer> clusterMetricsMap = new HashMap<>();
QueueInfo queueInfo = yarnClient.getQueueInfo(queue);
+ if (queueInfo == null) {
+ return Collections.emptyMap();
+ }
+
availableMB += queueInfo.getQueueStatistics().getAvailableMemoryMB();
availableVirtualCores += queueInfo.getQueueStatistics().getAvailableVCores();