You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "smallzhongfeng (via GitHub)" <gi...@apache.org> on 2023/03/09 12:19:41 UTC

[GitHub] [incubator-uniffle] smallzhongfeng commented on a diff in pull request #693: [WIP]feat: support stage recompute for spark clients

smallzhongfeng commented on code in PR #693:
URL: https://github.com/apache/incubator-uniffle/pull/693#discussion_r1130905917


##########
internal-client/src/main/java/org/apache/uniffle/client/impl/grpc/ShuffleManagerGrpcClient.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.client.impl.grpc;
+
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.client.api.ShuffleManagerClient;
+import org.apache.uniffle.client.request.RssReportShuffleFetchFailureRequest;
+import org.apache.uniffle.client.response.RssReportShuffleFetchFailureResponse;
+import org.apache.uniffle.common.exception.RssException;
+import org.apache.uniffle.proto.RssProtos;
+import org.apache.uniffle.proto.ShuffleManagerGrpc;
+
+public class ShuffleManagerGrpcClient extends GrpcClient implements ShuffleManagerClient {
+
+  private static final Logger LOG = LoggerFactory.getLogger(ShuffleManagerGrpcClient.class);
+  private static final long RPC_TIMEOUT_DEFAULT_MS = 60000;
+  private long rpcTimeout = RPC_TIMEOUT_DEFAULT_MS;
+  private ShuffleManagerGrpc.ShuffleManagerBlockingStub blockingStub;
+
+  public ShuffleManagerGrpcClient(String host, int port) {
+    this(host, port, 3);
+  }
+
+  public ShuffleManagerGrpcClient(String host, int port, int maxRetryAttempts) {
+    this(host, port, maxRetryAttempts, true);
+  }
+
+  public ShuffleManagerGrpcClient(String host, int port, int maxRetryAttempts, boolean usePlaintext) {
+    super(host, port, maxRetryAttempts, usePlaintext);
+    blockingStub = ShuffleManagerGrpc.newBlockingStub(channel);
+  }
+
+  public ShuffleManagerGrpc.ShuffleManagerBlockingStub getBlockingStub() {
+    return blockingStub.withDeadlineAfter(rpcTimeout, TimeUnit.MILLISECONDS);
+  }
+
+  public String getDesc() {
+    return "Shuffle manager grpc client ref " + host + ":" + port;
+  }
+  @Override
+  public RssReportShuffleFetchFailureResponse reportShuffleFetchFailure(RssReportShuffleFetchFailureRequest request) {
+    RssProtos.ReportShuffleFetchFailureRequest protoRequest = request.toProto();
+    int retryNum = 0;
+    while (retryNum <= maxRetryAttempts) {

Review Comment:
   What about using `RetryUtils` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org