Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repl ec to execute Java and scala code #4937

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

ChengJie1053
Copy link
Member

Add repl ec to execute Java and scala code

Java code execution result
image

scala code execution result
image

@@ -42,6 +42,9 @@ public class LabelCommonConfig {
public static final CommonVars<String> PYTHON_ENGINE_VERSION =
CommonVars.apply("wds.linkis.python.engine.version", "python2");

public static final CommonVars<String> REPL_ENGINE_VERSION =
CommonVars.apply("wds.linkis.repl.engine.version", "1");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove wds prefix

});

thread.start();
threadCache.put(taskId, thread);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no need to be asynchronous here? Just use the current thread and interrupt the thread when killing.

StringReader stringReader = new StringReader(code);
StringWriter stringWriter = new StringWriter();

ILoop repl = new ILoop(new BufferedReader(stringReader), new PrintWriter(stringWriter));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does scala's iloop need to be set to reuse mode so that multiple executions can be reused?


/**
* @Author linkis
* @Date 2023/10/9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove author and date

```json
{
"executionContent":{
"code":"package com.linkis.javassist;\n\nimport org.apache.commons.lang3.StringUtils;\n\n/**\n * @Author linkis\n * @Date 2023/10/9\n */\npublic class Test {\n public void sayHello() {\n System.out.println(\"hello\");\n System.out.println(StringUtils.isEmpty(\"hello\"));\n }\n}\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove author and date

<configuration status="error" monitorInterval="30">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be consistent with spark and hive engines

"{jdbc:\"%s\", es: \"%s\", presto:\"%s\", appconn:\"%s\", openlookeng:\"%s\", trino:\"%s\", nebula:\"%s\", hbase:\"%s\",io_file:\"root\"}",
jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser);
"{jdbc:\"%s\", es: \"%s\", presto:\"%s\", appconn:\"%s\", openlookeng:\"%s\", trino:\"%s\", nebula:\"%s\",repl:\"%s\", hbase:\"%s\",io_file:\"root\"}",
jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser, jvmUser);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multi-user execution function should be removed because Java and Scala have the risk of overreaching

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for reviewing the code


https://github.com/apache/dubbo
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some information about REPL(Read-Evaluate-Print Loop) plugin

pom.xml Outdated
<python.version>python2</python.version>
<seatunnel.version>2.1.2</seatunnel.version>
<shell.version>1</shell.version>
<sqoop.version>1.4.6</sqoop.version>
<elasticsearch.version>7.6.2</elasticsearch.version>

<!-- javassist -->
<javassist.version>3.28.0-GA</javassist.version>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just updated current dependence version? <javassist.version>3.27.0-GA</javassist.version>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for reviewing the code

Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@peacewong peacewong merged commit 2b6bb26 into apache:master Oct 26, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants