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 bb4c192a570 [improvement](doris compose) show all cluster (#28288)
bb4c192a570 is described below
commit bb4c192a5706d0da655bbc3a135ec8abbb8d417c
Author: yujun <[email protected]>
AuthorDate: Wed Dec 13 01:35:41 2023 +0800
[improvement](doris compose) show all cluster (#28288)
---
docker/runtime/doris-compose/Readme.md | 6 ++----
docker/runtime/doris-compose/cluster.py | 13 +++++++++++++
docker/runtime/doris-compose/command.py | 24 +++++++-----------------
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/docker/runtime/doris-compose/Readme.md
b/docker/runtime/doris-compose/Readme.md
index 13f543d4e70..7e7173e7d28 100644
--- a/docker/runtime/doris-compose/Readme.md
+++ b/docker/runtime/doris-compose/Readme.md
@@ -83,14 +83,12 @@ python docker/runtime/doris-compose/doris-compose.py
restart <cluster-name> --
### List doris cluster
```
-python docker/runtime/doris-compose/doris-compose.py ls <-a> <multiple
cluster names>
+python docker/runtime/doris-compose/doris-compose.py ls <multiple cluster
names>
```
if specific cluster names, it will list all the cluster's nodes.
-Otherwise it will just list summary of each clusters. If not specific -a, it
will list only active clusters.
-
-If specific `-a`, it will list the unactive clusters too.
+Otherwise it will just list summary of each clusters.
There are more options about doris-compose. Just try
diff --git a/docker/runtime/doris-compose/cluster.py
b/docker/runtime/doris-compose/cluster.py
index 51b98617e07..0f6afb906ab 100644
--- a/docker/runtime/doris-compose/cluster.py
+++ b/docker/runtime/doris-compose/cluster.py
@@ -78,6 +78,19 @@ def gen_subnet_prefix16():
raise Exception("Failed to gen subnet")
+def get_master_fe_endpoint(cluster_name):
+ master_fe_ip_file = get_cluster_path(cluster_name) + "/status/master_fe_ip"
+ if os.path.exists(master_fe_ip_file):
+ with open(master_fe_ip_file, "r") as f:
+ return "{}:{}".format(f.read().strip(), FE_QUERY_PORT)
+ try:
+ cluster = Cluster.load(cluster_name)
+ return "{}:{}".format(
+ cluster.get_node(Node.TYPE_FE, 1).get_ip(), FE_QUERY_PORT)
+ except:
+ return ""
+
+
class NodeMeta(object):
def __init__(self, image):
diff --git a/docker/runtime/doris-compose/command.py
b/docker/runtime/doris-compose/command.py
index 1c17cc1a00b..cfc3f137e16 100644
--- a/docker/runtime/doris-compose/command.py
+++ b/docker/runtime/doris-compose/command.py
@@ -269,14 +269,10 @@ class UpCommand(Command):
utils.exec_docker_compose_command(cluster.get_compose_file(), "up",
options, related_nodes)
- master_fe_ip_file = cluster.get_path() + "/status/master_fe_ip"
- master_fe_ip = ""
- if os.path.exists(master_fe_ip_file):
- master_fe_ip = open(master_fe_ip_file, "r").read().strip()
- else:
- master_fe_ip = cluster.get_node(CLUSTER.Node.TYPE_FE, 1).get_ip()
- LOG.info("Master fe query address: " + utils.render_green(
- "{}:{}".format(master_fe_ip, CLUSTER.FE_QUERY_PORT)) + "\n")
+ LOG.info(
+ "Master fe query address: " +
+ utils.render_green(CLUSTER.get_master_fe_endpoint(cluster.name)) +
+ "\n")
if not args.start:
LOG.info(
@@ -491,12 +487,6 @@ class ListCommand(Command):
"Specify multiple clusters, if specific, show all their
containers."
)
self._add_parser_output_json(parser)
- parser.add_argument(
- "-a",
- "--all",
- default=False,
- action=self._get_parser_bool_action(True),
- help="Show all clusters, include stopped or bad clusters.")
parser.add_argument("--detail",
default=False,
action=self._get_parser_bool_action(True),
@@ -576,7 +566,8 @@ class ListCommand(Command):
TYPE_COMPOSESERVICE = type(ComposeService("", "", ""))
if not args.NAME:
- header = ("CLUSTER", "OWNER", "STATUS", "CONFIG FILES")
+ header = ("CLUSTER", "OWNER", "STATUS", "MASTER FE",
+ "CONFIG FILES")
rows = []
for name in sorted(clusters.keys()):
cluster_info = clusters[name]
@@ -590,11 +581,10 @@ class ListCommand(Command):
"{}({})".format(status, count)
for status, count in service_statuses.items()
])
- if not args.all and service_statuses.get("running", 0) == 0:
- continue
owner = utils.get_path_owner(CLUSTER.get_cluster_path(name))
compose_file = CLUSTER.get_compose_file(name)
rows.append((name, owner, show_status,
+ CLUSTER.get_master_fe_endpoint(name),
"{}{}".format(compose_file,
cluster_info["status"])))
return self._handle_data(header, rows)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]