Updated on 2024-08-10 GMT+08:00

Commissioning the Python3 Sample Project

This section applies to MRS 3.3.0 or later.

Scenario

After the program code is written, you can commission the code in the Windows environment or upload the code to the Linux environment. If the local environment can communicate with the cluster service plane network, you can commission the program locally.

Procedure

  1. Refer to Configuring the Python3 Sample Project to obtain the sample code, obtain the hetu-jdbc-XXX.jar file, and copy it to the user-defined directory.
  2. Refer to KeyTab File Authentication Using HSFabric to obtain the user.keytab and krb5.conf files and save them to the customized directory.
  3. Edit the sample code, modify URLs, user information, and passwords based on the cluster requirements, and modify jdbc_location based on the actual path.
    • Example path in Windows: D:\\hetu-examples-python3\\hetu-jdbc-XXX.jar
    • Example path in Linux: /opt/hetu-examples-python3/hetu-jdbc-XXX.jar
  1. Run the python3 sample code.
    • In Windows, run the py script through pycharm or Python IDLE.
    • To run the sample code on Linux, install Java first.

      Go to the sample code path and run the py script. An example of the sample code path is /opt/hetu-examples-python3.

      cd /opt/hetu-examples-python3

      python3 JDBCExampleBroker.py

  1. View the command output.
    • In Windows, view the running result on the console.
      Figure 1 Running result
    • The following is an example of the running result in Linux:
      Aug 12, 2023 5:19:53 PM io.xxx.jdbc.$internal.airlift.log.Logger info
      INFO: hsbroker finalUri is https://192.168.43.223:29860
      Aug 12, 2023 5:19:53 PM io.xxx.jdbc.$internal.airlift.log.Logger info
      INFO: The final connection url is: //192.168.43.161:29888/hive/default
      Aug 12, 2023 5:19:53 PM io.xxx.jdbc.$internal.airlift.log.Logger info
      INFO: coordinator uri is //192.168.43.161:29888/hive/default
      [('default',), ('information_schema',)]