You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/27 04:10:42 UTC

[GitHub] [flink] wtog commented on a change in pull request #12179: [FLINK-16144] get client.timeout for the client, with a fallback to the akka.client…

wtog commented on a change in pull request #12179:
URL: https://github.com/apache/flink/pull/12179#discussion_r430522062



##########
File path: flink-clients/src/main/java/org/apache/flink/client/cli/ClientOptions.java
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.flink.client.cli;
+
+import org.apache.flink.configuration.AkkaOptions;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ConfigOptions;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.util.TimeUtils;
+
+import java.time.Duration;
+import java.util.Optional;
+
+/**
+ * Describes a client configuration parameter.
+ */
+public class ClientOptions {
+

Review comment:
       hi @kl0u, need i write like this ? 
   
   get client timeout value 
   from configurated client_timeout value orelse 
   execution.embedded-rpc-timeout value orelse 
   AkkaOptions.CLIENT_TIMEOUT orelse 
   client_timeout default value?
   
   ```java
   public static Duration getClientTimeout(Configuration configuration) {
   		Optional<Duration> timeoutOptional = configuration.getOptional(CLIENT_TIMEOUT);
   		if (timeoutOptional.isPresent()) {
   			return timeoutOptional.get();
   		} else {
   			Optional<Duration> rpcClientTimeout = configuration.getOptional(EMBEDDED_RPC_TIMEOUT);
   			if (rpcClientTimeout.isPresent()) {
   				return rpcClientTimeout.get();
   			} else {
   				Optional<String> akkaClientTimeout = configuration.getOptional(AkkaOptions.CLIENT_TIMEOUT);
   				if (akkaClientTimeout.isPresent()) {
   					return TimeUtils.parseDuration(akkaClientTimeout.get());
   				} else {
   					return CLIENT_TIMEOUT.defaultValue();
   				}
   			}
   		}
   	}
   ```
   
   

##########
File path: flink-clients/src/main/java/org/apache/flink/client/cli/ClientOptions.java
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.flink.client.cli;
+
+import org.apache.flink.configuration.AkkaOptions;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ConfigOptions;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.util.TimeUtils;
+
+import java.time.Duration;
+import java.util.Optional;
+
+/**
+ * Describes a client configuration parameter.
+ */
+public class ClientOptions {
+

Review comment:
       hi @kl0u, need i write like this ? 
   
   get client timeout value 
   from configurated **CLIENT_TIMEOUT** value orelse 
   **EMBEDDED_RPC_TIMEOUT** value orelse 
   **AkkaOptions.CLIENT_TIMEOUT** orelse 
   **CLIENT_TIMEOUT** default value?
   
   ```java
   public static Duration getClientTimeout(Configuration configuration) {
   		Optional<Duration> timeoutOptional = configuration.getOptional(CLIENT_TIMEOUT);
   		if (timeoutOptional.isPresent()) {
   			return timeoutOptional.get();
   		} else {
   			Optional<Duration> rpcClientTimeout = configuration.getOptional(EMBEDDED_RPC_TIMEOUT);
   			if (rpcClientTimeout.isPresent()) {
   				return rpcClientTimeout.get();
   			} else {
   				Optional<String> akkaClientTimeout = configuration.getOptional(AkkaOptions.CLIENT_TIMEOUT);
   				if (akkaClientTimeout.isPresent()) {
   					return TimeUtils.parseDuration(akkaClientTimeout.get());
   				} else {
   					return CLIENT_TIMEOUT.defaultValue();
   				}
   			}
   		}
   	}
   ```
   
   




----------------------------------------------------------------
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.

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