Repl engine usage documentation

This article mainly introduces the installation, use and configuration of the Repl engine plugin in Linkis.

It is strongly recommended that you check these environment variables for the executing user before executing Repl tasks. The specific way is

  1. sudo su - ${username}
  2. echo ${JAVA_HOME}

Compile the engine plug-in separately (requires a maven environment)

  1. # compile
  2. cd ${linkis_code_dir}/linkis-engineconn-plugins/repl/
  3. mvn clean install
  4. # The compiled engine plug-in package is located in the following directory
  5. ${linkis_code_dir}/linkis-engineconn-plugins/repl/target/out/

EngineConnPlugin engine plugin installation

Upload the engine plug-in package in 2.1 to the engine directory of the server

  1. ${LINKIS_HOME}/lib/linkis-engineplugins

The directory structure after uploading is as follows

  1. linkis-engineconn-plugins/
  2. ├── repl
  3. ├── dist
  4. └── 1
  5. ├── conf
  6. └── lib
  7. └── plugin
  8. └── 1

Refresh the engine by restarting the linkis-cg-linkismanager service

  1. cd ${LINKIS_HOME}/sbin
  2. sh linkis-daemon.sh restart cg-linkismanager

You can check whether the last_update_time of this table in the linkis_engine_conn_plugin_bml_resources in the database is the time when the refresh is triggered.

  1. #Login to the linkis database
  2. select * from linkis_cg_engine_conn_plugin_bml_resources;

Single method

  1. sh bin/linkis-cli -engineType repl-1 -code \
  2. "import org.apache.commons.lang3.StringUtils;
  3. public void sayHello() {
  4. System.out.println(\"hello\");
  5. System.out.println(StringUtils.isEmpty(\"hello\"));
  6. }" \
  7. -codeType repl -runtimeMap linkis.repl.type=java

Multiple methods

  1. sh bin/linkis-cli -engineType repl-1 -code \
  2. "import org.apache.commons.lang3.StringUtils;
  3. public void sayHello() {
  4. System.out.println(\"hello\");
  5. System.out.println(StringUtils.isEmpty(\"hello\"));
  6. }
  7. public void sayHi() {
  8. System.out.println(\"hi\");
  9. System.out.println(StringUtils.isEmpty(\"hi\"));
  10. }" \
  11. -codeType repl -runtimeMap linkis.repl.type=java -runtimeMap linkis.repl.method.name=sayHi
  1. sh bin/linkis-cli -engineType repl-1 -code \
  2. "import org.apache.commons.io.FileUtils
  3. import java.io.File
  4. val x = 2 + 3;
  5. println(x);
  6. FileUtils.forceMkdir(new File(\"/tmp/linkis_repl_scala_test\"));" \
  7. -codeType repl -runtimeMap linkis.repl.type=scala

More Linkis-Cli command parameter reference: Linkis-Cli usage

Repl engine supports connection parameters:

Configuration nameRemarks and default valueIs it necessary
linkis.repl.typerepl type, supports java and scala, default value: javaOptional
linkis.repl.method.nameThe name of the method to execute. The default value is nullOptional