You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/29 01:55:54 UTC

[GitHub] [dolphinscheduler] kezhenxu94 commented on a change in pull request #8248: [python] Fix python api can't connect to remote gateway server

kezhenxu94 commented on a change in pull request #8248:
URL: https://github.com/apache/dolphinscheduler/pull/8248#discussion_r794982656



##########
File path: dolphinscheduler-python/src/main/java/org/apache/dolphinscheduler/server/PythonGatewayServer.java
##########
@@ -501,10 +507,28 @@ public void createUser(String userName,
 
     @PostConstruct
     public void run() {
-        GatewayServer server = new GatewayServer(this);
-        GatewayServer.turnLoggingOn();
-        // Start server to accept python client socket
-        server.start();
+        GatewayServer server;
+        try {
+            InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfig.getGatewayServerAddress());
+            InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfig.getPythonAddress());
+            server = new GatewayServer(
+                this,
+                pythonGatewayConfig.getGatewayServerPort(),
+                pythonGatewayConfig.getPythonPort(),
+                gatewayHost,
+                pythonHost,
+                pythonGatewayConfig.getConnectTimeout(),
+                pythonGatewayConfig.getReadTimeout(),
+                null
+            );
+            GatewayServer.turnLoggingOn();
+            logger.info("PythonGatewayServer started on: " + gatewayHost.toString());
+            server.start();
+        }
+        catch (UnknownHostException e) {
+            logger.error("exception occurred while constructing PythonGatewayServer().");
+            e.printStackTrace();
+        }

Review comment:
       ```suggestion
           } catch (UnknownHostException e) {
               logger.error("exception occurred while constructing PythonGatewayServer().", e);
           }
   ```




-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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