Skip to content

Commit 044c9ef

Browse files
authored
fix(python): refresh channel incase the service becomes available after initial heart beat (#4338)
also bump up rustup toolchain version to 1.76.0 to avoid some rust packages compilation failure.
1 parent 4d7bd16 commit 044c9ef

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

k8s/dockerfiles/graphscope-store.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY --chown=graphscope:graphscope . /home/graphscope/graphscope
1414
COPY --chown=graphscope:graphscope ./interactive_engine/assembly/src/conf/maven.settings.xml /home/graphscope/.m2/settings.xml
1515

1616
USER graphscope
17+
RUN rustup toolchain install 1.76.0 && rustup default 1.76.0
1718

1819
RUN cd /home/graphscope/graphscope \
1920
&& . ~/.graphscope_env \

k8s/dockerfiles/interactive.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN cd /home/graphscope/GraphScope/ && \
1818
else \
1919
mkdir /home/graphscope/install; \
2020
. /home/graphscope/.graphscope_env; \
21+
rustup toolchain install 1.76.0 && rustup default 1.76.0; \
2122
make interactive-install BUILD_TYPE="$profile" INSTALL_PREFIX=/home/graphscope/install; \
2223
fi
2324

k8s/internal/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ graphscope-manylinux2014-py3-nodocker:
110110
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
111111
sudo yum install java-11-openjdk-devel -y && \
112112
sudo yum remove java-1.8.0-openjdk-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless -y && \
113+
rustup toolchain install 1.76.0 && rustup default 1.76.0 && \
113114
cd $(WORKING_DIR)/../.. && \
114115
if [[ "${PLATFORM}" == "aarch64" ]]; then \
115116
export AUDITWHEEL_PLAT=manylinux2014_${PLATFORM}; \

python/graphscope/client/rpc.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,23 @@ class GRPCClient(object):
4141
def __init__(self, launcher, endpoint, reconnect=False):
4242
"""Connect to GRAPE engine at the given :code:`endpoint`."""
4343
# create the gRPC stub
44-
options = [
44+
self._options = [
4545
("grpc.max_send_message_length", GS_GRPC_MAX_MESSAGE_LENGTH),
4646
("grpc.max_receive_message_length", GS_GRPC_MAX_MESSAGE_LENGTH),
4747
("grpc.max_metadata_size", GS_GRPC_MAX_MESSAGE_LENGTH),
4848
]
49+
self._endpoint = endpoint
4950
self._launcher = launcher
5051
self._grpc_utils = GRPCUtils()
51-
self._channel = grpc.insecure_channel(endpoint, options=options)
52-
self._stub = coordinator_service_pb2_grpc.CoordinatorServiceStub(self._channel)
52+
self._stub = self._get_stub()
5353
self._session_id = None
5454
self._logs_fetching_thread = None
5555
self._reconnect = reconnect
5656

57+
def _get_stub(self):
58+
channel = grpc.insecure_channel(self._endpoint, options=self._options)
59+
return coordinator_service_pb2_grpc.CoordinatorServiceStub(channel)
60+
5761
def waiting_service_ready(self, timeout_seconds=60):
5862
begin_time = time.time()
5963
request = message_pb2.HeartBeatRequest()
@@ -76,6 +80,9 @@ def waiting_service_ready(self, timeout_seconds=60):
7680
logger.warning("Heart beat analytical engine failed, %s", msg)
7781
if time.time() - begin_time >= timeout_seconds:
7882
raise ConnectionError(f"Connect coordinator timeout, {msg}")
83+
# refresh the channel incase the server became available
84+
if e.code() == grpc.StatusCode.UNAVAILABLE:
85+
self._stub = self._get_stub()
7986
time.sleep(1)
8087

8188
def connect(self, cleanup_instance=True, dangling_timeout_seconds=60):

0 commit comments

Comments
 (0)