This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 82d84fbab64 [improve](doris compose) ls detail command print node's
path (#39767)
82d84fbab64 is described below
commit 82d84fbab6473093bc29d171b2b12f526be8943b
Author: yujun <[email protected]>
AuthorDate: Fri Aug 23 12:22:40 2024 +0800
[improve](doris compose) ls detail command print node's path (#39767)
---
docker/runtime/doris-compose/cluster.py | 17 ++++++--
docker/runtime/doris-compose/command.py | 4 ++
docker/runtime/doris-compose/utils.py | 7 +++
.../doris/regression/suite/SuiteCluster.groovy | 50 ++++++++++++++++++++--
4 files changed, 70 insertions(+), 8 deletions(-)
diff --git a/docker/runtime/doris-compose/cluster.py
b/docker/runtime/doris-compose/cluster.py
index 83005cc0cf5..91947164096 100644
--- a/docker/runtime/doris-compose/cluster.py
+++ b/docker/runtime/doris-compose/cluster.py
@@ -56,6 +56,15 @@ def get_cluster_path(cluster_name):
return os.path.join(LOCAL_DORIS_PATH, cluster_name)
+def get_node_name(node_type, id):
+ return "{}-{}".format(node_type, id)
+
+
+def get_node_path(cluster_name, node_type, id):
+ return os.path.join(get_cluster_path(cluster_name),
+ get_node_name(node_type, id))
+
+
def get_compose_file(cluster_name):
return os.path.join(get_cluster_path(cluster_name), "docker-compose.yml")
@@ -246,11 +255,10 @@ class Node(object):
return ["conf", "log"]
def get_name(self):
- return "{}-{}".format(self.node_type(), self.id)
+ return get_node_name(self.node_type(), self.id)
def get_path(self):
- return os.path.join(get_cluster_path(self.cluster.name),
- self.get_name())
+ return get_node_path(self.cluster.name, self.node_type(), self.id)
def get_image(self):
return self.meta.image
@@ -627,7 +635,8 @@ class Cluster(object):
os.chmod(LOCAL_DORIS_PATH, 0o777)
lock_file = os.path.join(LOCAL_DORIS_PATH, "lock")
with filelock.FileLock(lock_file):
- os.chmod(lock_file, 0o666)
+ if os.getuid() == utils.get_path_uid(lock_file):
+ os.chmod(lock_file, 0o666)
subnet = gen_subnet_prefix16()
cluster = Cluster(name, subnet, image, is_cloud, fe_config,
be_config, ms_config, recycle_config, be_disks,
diff --git a/docker/runtime/doris-compose/command.py
b/docker/runtime/doris-compose/command.py
index b0863eae153..8611689c9a5 100644
--- a/docker/runtime/doris-compose/command.py
+++ b/docker/runtime/doris-compose/command.py
@@ -702,6 +702,8 @@ class ListNode(object):
if detail:
query_port = ""
http_port = ""
+ node_path = CLUSTER.get_node_path(self.cluster_name,
+ self.node_type, self.id)
if self.node_type == CLUSTER.Node.TYPE_FE:
query_port = CLUSTER.FE_QUERY_PORT
http_port = CLUSTER.FE_HTTP_PORT
@@ -714,6 +716,7 @@ class ListNode(object):
result += [
query_port,
http_port,
+ node_path,
]
return result
@@ -967,6 +970,7 @@ class ListCommand(Command):
header += [
"query_port",
"http_port",
+ "path",
]
rows = []
diff --git a/docker/runtime/doris-compose/utils.py
b/docker/runtime/doris-compose/utils.py
index 54255b597bc..01dfb64fe42 100644
--- a/docker/runtime/doris-compose/utils.py
+++ b/docker/runtime/doris-compose/utils.py
@@ -291,6 +291,13 @@ def get_path_owner(path):
return ""
+def get_path_uid(path):
+ try:
+ return os.stat(path).st_uid
+ except:
+ return ""
+
+
def read_compose_file(file):
with open(file, "r") as f:
return yaml.safe_load(f.read())
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy
index 68a57ad27f3..9789b751fed 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy
@@ -95,12 +95,14 @@ class ServerNode {
String host
int httpPort
boolean alive
+ String path
static void fromCompose(ServerNode node, ListHeader header, int index,
List<Object> fields) {
node.index = index
node.host = (String) fields.get(header.indexOf('IP'))
node.httpPort = (Integer) fields.get(header.indexOf('http_port'))
node.alive = fields.get(header.indexOf('alive')) == 'true'
+ node.path = (String) fields.get(header.indexOf('path'))
}
static long toLongOrDefault(Object val, long defValue) {
@@ -130,6 +132,14 @@ class ServerNode {
assert false : 'Unknown node type'
}
+ String getLogFilePath() {
+ assert false : 'Unknown node type'
+ }
+
+ String getConfFilePath() {
+ assert false : 'Unknown node type'
+ }
+
}
class Frontend extends ServerNode {
@@ -149,6 +159,14 @@ class Frontend extends ServerNode {
return NodeType.FE
}
+ String getLogFilePath() {
+ return path + '/log/fe.log'
+ }
+
+ String getConfFilePath() {
+ return path + '/conf/fe.conf'
+ }
+
}
class Backend extends ServerNode {
@@ -168,6 +186,14 @@ class Backend extends ServerNode {
return NodeType.BE
}
+ String getLogFilePath() {
+ return path + '/log/be.INFO'
+ }
+
+ String getConfFilePath() {
+ return path + '/conf/be.conf'
+ }
+
}
class MetaService extends ServerNode {
@@ -182,6 +208,14 @@ class MetaService extends ServerNode {
return NodeType.MS
}
+ String getLogFilePath() {
+ return path + '/log/meta_service.INFO'
+ }
+
+ String getConfFilePath() {
+ return path + '/conf/doris_cloud.conf'
+ }
+
}
class Recycler extends ServerNode {
@@ -196,6 +230,14 @@ class Recycler extends ServerNode {
return NodeType.RECYCLER
}
+ String getLogFilePath() {
+ return path + '/log/recycler.INFO'
+ }
+
+ String getConfFilePath() {
+ return path + '/conf/doris_cloud.conf'
+ }
+
}
@Slf4j
@@ -362,14 +404,14 @@ class SuiteCluster {
} else if (name.startsWith('fe-')) {
int index = name.substring('fe-'.length()) as int
frontends.add(Frontend.fromCompose(header, index, row))
- } else if (name.startsWith('ms-')){
+ } else if (name.startsWith('ms-')) {
int index = name.substring('ms-'.length()) as int
metaservices.add(MetaService.fromCompose(header, index, row))
- } else if (name.startsWith('recycle-')){
+ } else if (name.startsWith('recycle-')) {
int index = name.substring('recycle-'.length()) as int
recyclers.add(Recycler.fromCompose(header, index, row))
} else if (name.startsWith('fdb-')) {
- // current not used
+ // current not used
} else {
assert false : 'Unknown node type with name: ' + name
}
@@ -382,7 +424,7 @@ class SuiteCluster {
return result.first
}
- List<Integer> addBackend(int num, String ClusterName="") throws Exception {
+ List<Integer> addBackend(int num, String ClusterName='') throws Exception {
def result = add(0, num, ClusterName)
return result.second
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]