Skip to content

Commit d28c663

Browse files
authored
Wait etcd ready before launching vineyard container. (#23)
1 parent 69f401e commit d28c663

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

python/graphscope/deploy/kubernetes/resource_builder.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,24 @@ def __init__(self, name, labels, num_workers, image_pull_policy):
558558
def add_vineyard_container(
559559
self, name, image, cpu, mem, shared_mem, etcd_endpoint, port, **kwargs
560560
):
561-
cmd = [
562-
"vineyardd",
563-
"--size=%s" % str(shared_mem),
564-
"--etcd_endpoint=http://%s" % etcd_endpoint,
565-
"--socket=%s" % self._ipc_socket_file,
566-
"--etcd_prefix=vineyard",
567-
]
561+
vineyard_command = " ".join(
562+
[
563+
"vineyardd",
564+
"--size=%s" % str(shared_mem),
565+
"--etcd_endpoint=http://%s" % etcd_endpoint,
566+
"--socket=%s" % self._ipc_socket_file,
567+
"--etcd_prefix=vineyard",
568+
]
569+
)
570+
commands = []
571+
commands.append(
572+
"while ! curl --output /dev/null --silent --head --connect-timeout 1 %s"
573+
% etcd_endpoint
574+
)
575+
commands.append("do sleep 1 && echo -n .")
576+
commands.append("done")
577+
commands.append(vineyard_command)
578+
cmd = ["bash", "-c", "%s" % ("; ".join(commands),)]
568579

569580
resources_dict = {
570581
"requests": ResourceBuilder(cpu, mem).build(),

0 commit comments

Comments
 (0)