From ba5cbf4eb7a8e1c9ea17bab685ff2e7739c51f69 Mon Sep 17 00:00:00 2001
From: yangzhiyue <904666286@qq.com>
Date: Wed, 3 Jun 2020 17:20:33 +0800
Subject: [PATCH 1/8] linkis version, 0.9.3 to 0.9.4
---
assembly/pom.xml | 2 +-
assembly/public-module/pom.xml | 2 +-
bml/bml-engine-hook/pom.xml | 2 +-
bml/bmlclient/pom.xml | 2 +-
bml/bmlcommon/pom.xml | 2 +-
bml/bmlserver/pom.xml | 2 +-
conf/config.sh | 2 +-
core/cloudModule/pom.xml | 2 +-
core/cloudMybatis/pom.xml | 2 +-
core/cloudProtocol/pom.xml | 2 +-
core/cloudRPC/pom.xml | 2 +-
core/common/pom.xml | 2 +-
core/hadoop-common/pom.xml | 2 +-
core/httpclient/pom.xml | 2 +-
core/scheduler/pom.xml | 2 +-
datasource/datasourcemanager/common/pom.xml | 2 +-
datasource/metadatamanager/common/pom.xml | 2 +-
.../metadatamanager/elasticsearch/pom.xml | 2 +-
.../metadatamanager/mysql/service/pom.xml | 2 +-
.../metadatamanager/service/hive/pom.xml | 2 +-
datasourcemanager/server/pom.xml | 2 +-
...ith_a_new_computation_or_storage_engine.md | 172 ++---
docs/en_US/ch3/Linkis User Manual.md | 710 +++++++++---------
docs/en_US/ch3/Linkis_Java_SDK_doc.md | 314 ++++----
...77\347\224\250\346\226\207\346\241\243.md" | 2 +-
...30\345\202\250\345\274\225\346\223\216.md" | 6 +-
...77\347\224\250\346\226\207\346\241\243.md" | 6 +-
eurekaServer/pom.xml | 2 +-
extensions/spark-excel/pom.xml | 2 +-
gateway/core/pom.xml | 2 +-
gateway/gateway-httpclient-support/pom.xml | 2 +-
gateway/gateway-ujes-support/pom.xml | 2 +-
gateway/springcloudgateway/pom.xml | 2 +-
metadata/pom.xml | 2 +-
pom.xml | 10 +-
publicService/application/pom.xml | 4 +-
publicService/configuration/pom.xml | 2 +-
publicService/jobhistory/pom.xml | 2 +-
publicService/pom.xml | 2 +-
publicService/udf/pom.xml | 2 +-
publicService/variable/pom.xml | 2 +-
.../client/workspace-httpclient/pom.xml | 2 +-
publicService/workspace/pom.xml | 2 +-
resourceManager/resourcemanagerclient/pom.xml | 2 +-
resourceManager/resourcemanagercommon/pom.xml | 2 +-
resourceManager/resourcemanagerserver/pom.xml | 2 +-
storage/pesIO/io-engine/pom.xml | 2 +-
storage/pesIO/io-enginemanager/pom.xml | 2 +-
storage/pesIO/io-entrance/pom.xml | 2 +-
storage/storage/pom.xml | 2 +-
ujes/client/pom.xml | 2 +-
ujes/definedEngines/hive/engine/pom.xml | 2 +-
.../definedEngines/hive/enginemanager/pom.xml | 2 +-
ujes/definedEngines/hive/entrance/pom.xml | 2 +-
ujes/definedEngines/jdbc/entrance/pom.xml | 4 +-
ujes/definedEngines/mlsql/entrance/pom.xml | 2 +-
ujes/definedEngines/pipeline/engine/pom.xml | 2 +-
.../pipeline/enginemanager/pom.xml | 2 +-
ujes/definedEngines/pipeline/entrance/pom.xml | 2 +-
ujes/definedEngines/python/engine/pom.xml | 2 +-
.../python/enginemanager/pom.xml | 6 +-
ujes/definedEngines/python/entrance/pom.xml | 2 +-
ujes/definedEngines/shell/engine/pom.xml | 2 +-
.../shell/enginemanager/pom.xml | 2 +-
ujes/definedEngines/shell/entrance/pom.xml | 2 +-
ujes/definedEngines/spark/engine/pom.xml | 2 +-
.../spark/enginemanager/pom.xml | 2 +-
ujes/definedEngines/spark/entrance/pom.xml | 2 +-
ujes/definedEngines/tispark/engine/pom.xml | 2 +-
ujes/engine/pom.xml | 2 +-
ujes/enginemanager/pom.xml | 2 +-
ujes/entrance/pom.xml | 2 +-
ujes/entranceclient/pom.xml | 2 +-
ujes/jdbc/pom.xml | 4 +-
userControl/pom.xml | 2 +-
75 files changed, 683 insertions(+), 683 deletions(-)
diff --git a/assembly/pom.xml b/assembly/pom.xml
index b9170de816..11c9ae554c 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -21,7 +21,7 @@
com.webank.wedatasphere.linkis
linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/assembly/public-module/pom.xml b/assembly/public-module/pom.xml
index ba3a041fe2..5cced71f20 100644
--- a/assembly/public-module/pom.xml
+++ b/assembly/public-module/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/bml/bml-engine-hook/pom.xml b/bml/bml-engine-hook/pom.xml
index 9b525ffaaa..3808605c76 100644
--- a/bml/bml-engine-hook/pom.xml
+++ b/bml/bml-engine-hook/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/bml/bmlclient/pom.xml b/bml/bmlclient/pom.xml
index cb188a61f9..5ea5c5c448 100644
--- a/bml/bmlclient/pom.xml
+++ b/bml/bmlclient/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/bml/bmlcommon/pom.xml b/bml/bmlcommon/pom.xml
index 7aca4b27ce..7b0fa54abe 100644
--- a/bml/bmlcommon/pom.xml
+++ b/bml/bmlcommon/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/bml/bmlserver/pom.xml b/bml/bmlserver/pom.xml
index aff1dcc076..ad028b13a8 100644
--- a/bml/bmlserver/pom.xml
+++ b/bml/bmlserver/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/conf/config.sh b/conf/config.sh
index 79e7848f10..c707d8e496 100644
--- a/conf/config.sh
+++ b/conf/config.sh
@@ -119,4 +119,4 @@ BML_PORT=9113
## java application default jvm memory
export SERVER_HEAP_SIZE="512M"
-LINKIS_VERSION=0.9.3
+LINKIS_VERSION=0.9.4
diff --git a/core/cloudModule/pom.xml b/core/cloudModule/pom.xml
index 576289b485..b8f9df12e8 100644
--- a/core/cloudModule/pom.xml
+++ b/core/cloudModule/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/core/cloudMybatis/pom.xml b/core/cloudMybatis/pom.xml
index 3b917bdc70..700ba3c83d 100644
--- a/core/cloudMybatis/pom.xml
+++ b/core/cloudMybatis/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
jar
diff --git a/core/cloudProtocol/pom.xml b/core/cloudProtocol/pom.xml
index da11c8d427..724286aed7 100644
--- a/core/cloudProtocol/pom.xml
+++ b/core/cloudProtocol/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/core/cloudRPC/pom.xml b/core/cloudRPC/pom.xml
index e381f961f4..1e4467798f 100644
--- a/core/cloudRPC/pom.xml
+++ b/core/cloudRPC/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/core/common/pom.xml b/core/common/pom.xml
index c4c7998239..3523a51312 100644
--- a/core/common/pom.xml
+++ b/core/common/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/core/hadoop-common/pom.xml b/core/hadoop-common/pom.xml
index a691d8d99c..ef84036e1e 100644
--- a/core/hadoop-common/pom.xml
+++ b/core/hadoop-common/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/core/httpclient/pom.xml b/core/httpclient/pom.xml
index 6b501b1736..51df03ddf3 100644
--- a/core/httpclient/pom.xml
+++ b/core/httpclient/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/core/scheduler/pom.xml b/core/scheduler/pom.xml
index 9ec1a9f73e..487de51072 100644
--- a/core/scheduler/pom.xml
+++ b/core/scheduler/pom.xml
@@ -22,7 +22,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-scheduler
diff --git a/datasource/datasourcemanager/common/pom.xml b/datasource/datasourcemanager/common/pom.xml
index cf21b26366..34841cd53a 100644
--- a/datasource/datasourcemanager/common/pom.xml
+++ b/datasource/datasourcemanager/common/pom.xml
@@ -18,7 +18,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/datasource/metadatamanager/common/pom.xml b/datasource/metadatamanager/common/pom.xml
index 7f0c5e981e..2d3755fcdb 100644
--- a/datasource/metadatamanager/common/pom.xml
+++ b/datasource/metadatamanager/common/pom.xml
@@ -18,7 +18,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/datasource/metadatamanager/elasticsearch/pom.xml b/datasource/metadatamanager/elasticsearch/pom.xml
index 4727619725..21d5c0759c 100644
--- a/datasource/metadatamanager/elasticsearch/pom.xml
+++ b/datasource/metadatamanager/elasticsearch/pom.xml
@@ -18,7 +18,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/datasource/metadatamanager/mysql/service/pom.xml b/datasource/metadatamanager/mysql/service/pom.xml
index bb3cba0677..65acc14528 100644
--- a/datasource/metadatamanager/mysql/service/pom.xml
+++ b/datasource/metadatamanager/mysql/service/pom.xml
@@ -18,7 +18,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/datasource/metadatamanager/service/hive/pom.xml b/datasource/metadatamanager/service/hive/pom.xml
index 3f28e117f6..1f92b4514e 100644
--- a/datasource/metadatamanager/service/hive/pom.xml
+++ b/datasource/metadatamanager/service/hive/pom.xml
@@ -18,7 +18,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
linkis-metadatamanager-service-hive
diff --git a/datasourcemanager/server/pom.xml b/datasourcemanager/server/pom.xml
index ea7dff386e..a20439d415 100644
--- a/datasourcemanager/server/pom.xml
+++ b/datasourcemanager/server/pom.xml
@@ -18,7 +18,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/docs/en_US/ch3/How_to_adapt_Linkis_with_a_new_computation_or_storage_engine.md b/docs/en_US/ch3/How_to_adapt_Linkis_with_a_new_computation_or_storage_engine.md
index d7b679a769..ed67b027b6 100644
--- a/docs/en_US/ch3/How_to_adapt_Linkis_with_a_new_computation_or_storage_engine.md
+++ b/docs/en_US/ch3/How_to_adapt_Linkis_with_a_new_computation_or_storage_engine.md
@@ -1,86 +1,86 @@
-# How to adapt Linkis with a new computation or storage engine
-
-## 1. Introduction
-
-Except using the engines developed by Linkis directly, backend developers can also develop their own applications based on their requirements.
-Divided into Entrance, EngineManager and Engine modules, one can easily split an application to adapt to Linkis.
-The purpose and archetecture of these three modules please refer to Linkis Archetect Design Docs[UJES架构设计文档](../ch4/Linkis-UJES设计文档.md).
-
-
-## 2. Declaration
-
-Linkis uses Spring framework as the underlying technique. So the Spring development specs must be obeyed.
-
-Linkis has an elastic underlying achitecture and provides common implementations for almost all of its top-level interfaces. If customized classes are needed by users, they can be directly injected and replace the current implementations.
-
-
-### 2.1 Entrance module adaption
-
-**1) maven dependency**
-
-```xml
-
- com.webank.wedatasphere.Linkis
- Linkis-ujes-entrance
- 0.9.3
-
-```
-
-**2)Interfaces to be implemented**
-
-There is no compulsary interface in Entrance. Below interfaces can be implemented on demand.
-- EntranceParser. Used to parse request maps from frontend to a persistable Task. Class AbstractEntranceParser is already provided and only parseToTask method needs to be overrided. Linkis provides CommonEntranceParser as the default implementation.
-- EngineRequester. Used to build a RequestEngine object, which can be used to request a new engine from the EngineManager.
-- Scheduler. Used to schedule tasks. The default implementation provides parallel mode for multi-user situations and FIFO mode for single user pattern. It is not suggested to be customized without special purposes.
-
-### 2.2 EngineManager module adaption
-
-**1) maven dependency**
-
-```xml
-
- com.webank.wedatasphere.Linkis
- Linkis-ujes-enginemanager
- 0.9.3
-
-```
-
-**2)Interfaces to be implemented**
-
-Below interfaces are required to be implemented in EngineManager:
-- EngineCreator. Method createProcessEngineBuilder needs to be overridden in the existing AbstractEngineCreator to create an EngineBuilder.
-Here ProcessEngineBuilder has already provided a class called JavaProcessEngineBuilder, which is an abstract class accomplishes configurations of classpath, JavaOpts, GC file path and log path, and opening DEBUG port in test mode. To implement JavaProcessEngineBuilder, only extra classpath and JavaOpts are needed to be specified.
-- EngineResourceFactory. Method getRequestResource needs to be overridden in the existing AbstractEngineResourceFactory to declare user customized resource requirements.
-- resources. A Spring bean used to register resources to RM. Users need to specify an instance of ModuleInfo for dependency injection.
-
-Below interfaces/beans are optional in EngineManager:
-- hooks. A Spring bean used to add pre and post hooks around the Engine startup procedure. Users need to declare an Spring bean in type EngineHook[] hooks to make new hooks effective. For details please refer to com.webank.wedatasphere.linkis.enginemanager.impl.EngineManagerSpringConfiguration.
-
-
-### 2.3 Engine module adaption
-
-**1) maven dependency**
-
-```xml
-
- com.webank.wedatasphere.Linkis
- Linkis-ujes-engine
- 0.9.3
-
-```
-
-
-**2)Interfaces to be implemented**
-
-Below interfaces are required to be implemented in Engine:
-- EngineExecutorFactory. Used to build an EngineExecutor from a Map by implementing method createExecutor. This map contains evironment variables and engine arguments.
-- EngineExecutor. The actual executor to execute the code submitted from the entrance.
- Methods need to be implemented:
- 1. getActualUsedResources(the resource an engine acually used)
- 2. executeLine(execute a line of the code parsed by CodeParser)
- 3. executeCompletely(the suplementary method for executeLine. If executeLine returns ExecuteIncomplete, new code will be submitted with the previous code together to the engine)
-
-Below interfaces/beans are optional in Engine:
-- engineHooks: Array[EngineHook], a Spring bean used to add pre and post hooks around the Engine startup procedure. Currently the system provides 2 hooks: CodeGeneratorEngineHook for UDF/Function loading and ReleaseEngineHook for releasing spare engines. The system registers engineHooks=Array(ReleaseEngineHook) only by default.
-- CodeParser. Used to parse code into lines and submit one line only for each execution loop. The system registers a CodeParser returns all the code at once by default.
-- EngineParser. Used to convert a RequestTask to a Job that is acceptable by Scheduler. If not specified, the system registers an EngineParser that converts RequestTask to CommonEngineJob.
+# How to adapt Linkis with a new computation or storage engine
+
+## 1. Introduction
+
+Except using the engines developed by Linkis directly, backend developers can also develop their own applications based on their requirements.
+Divided into Entrance, EngineManager and Engine modules, one can easily split an application to adapt to Linkis.
+The purpose and archetecture of these three modules please refer to Linkis Archetect Design Docs[UJES架构设计文档](../ch4/Linkis-UJES设计文档.md).
+
+
+## 2. Declaration
+
+Linkis uses Spring framework as the underlying technique. So the Spring development specs must be obeyed.
+
+Linkis has an elastic underlying achitecture and provides common implementations for almost all of its top-level interfaces. If customized classes are needed by users, they can be directly injected and replace the current implementations.
+
+
+### 2.1 Entrance module adaption
+
+**1) maven dependency**
+
+```xml
+
+ com.webank.wedatasphere.Linkis
+ Linkis-ujes-entrance
+ 0.9.4
+
+```
+
+**2)Interfaces to be implemented**
+
+There is no compulsary interface in Entrance. Below interfaces can be implemented on demand.
+- EntranceParser. Used to parse request maps from frontend to a persistable Task. Class AbstractEntranceParser is already provided and only parseToTask method needs to be overrided. Linkis provides CommonEntranceParser as the default implementation.
+- EngineRequester. Used to build a RequestEngine object, which can be used to request a new engine from the EngineManager.
+- Scheduler. Used to schedule tasks. The default implementation provides parallel mode for multi-user situations and FIFO mode for single user pattern. It is not suggested to be customized without special purposes.
+
+### 2.2 EngineManager module adaption
+
+**1) maven dependency**
+
+```xml
+
+ com.webank.wedatasphere.Linkis
+ Linkis-ujes-enginemanager
+ 0.9.4
+
+```
+
+**2)Interfaces to be implemented**
+
+Below interfaces are required to be implemented in EngineManager:
+- EngineCreator. Method createProcessEngineBuilder needs to be overridden in the existing AbstractEngineCreator to create an EngineBuilder.
+Here ProcessEngineBuilder has already provided a class called JavaProcessEngineBuilder, which is an abstract class accomplishes configurations of classpath, JavaOpts, GC file path and log path, and opening DEBUG port in test mode. To implement JavaProcessEngineBuilder, only extra classpath and JavaOpts are needed to be specified.
+- EngineResourceFactory. Method getRequestResource needs to be overridden in the existing AbstractEngineResourceFactory to declare user customized resource requirements.
+- resources. A Spring bean used to register resources to RM. Users need to specify an instance of ModuleInfo for dependency injection.
+
+Below interfaces/beans are optional in EngineManager:
+- hooks. A Spring bean used to add pre and post hooks around the Engine startup procedure. Users need to declare an Spring bean in type EngineHook[] hooks to make new hooks effective. For details please refer to com.webank.wedatasphere.linkis.enginemanager.impl.EngineManagerSpringConfiguration.
+
+
+### 2.3 Engine module adaption
+
+**1) maven dependency**
+
+```xml
+
+ com.webank.wedatasphere.Linkis
+ Linkis-ujes-engine
+ 0.9.4
+
+```
+
+
+**2)Interfaces to be implemented**
+
+Below interfaces are required to be implemented in Engine:
+- EngineExecutorFactory. Used to build an EngineExecutor from a Map by implementing method createExecutor. This map contains evironment variables and engine arguments.
+- EngineExecutor. The actual executor to execute the code submitted from the entrance.
+ Methods need to be implemented:
+ 1. getActualUsedResources(the resource an engine acually used)
+ 2. executeLine(execute a line of the code parsed by CodeParser)
+ 3. executeCompletely(the suplementary method for executeLine. If executeLine returns ExecuteIncomplete, new code will be submitted with the previous code together to the engine)
+
+Below interfaces/beans are optional in Engine:
+- engineHooks: Array[EngineHook], a Spring bean used to add pre and post hooks around the Engine startup procedure. Currently the system provides 2 hooks: CodeGeneratorEngineHook for UDF/Function loading and ReleaseEngineHook for releasing spare engines. The system registers engineHooks=Array(ReleaseEngineHook) only by default.
+- CodeParser. Used to parse code into lines and submit one line only for each execution loop. The system registers a CodeParser returns all the code at once by default.
+- EngineParser. Used to convert a RequestTask to a Job that is acceptable by Scheduler. If not specified, the system registers an EngineParser that converts RequestTask to CommonEngineJob.
diff --git a/docs/en_US/ch3/Linkis User Manual.md b/docs/en_US/ch3/Linkis User Manual.md
index 6ab6c1853d..c5fac81444 100644
--- a/docs/en_US/ch3/Linkis User Manual.md
+++ b/docs/en_US/ch3/Linkis User Manual.md
@@ -1,356 +1,356 @@
-## Linkis User Manual
-
-#### 1.Summary
- Designed by Webank independently, Linkis is an extensible framework and a sophisticated solution for big data task submission. Conveniently, it could be used directly together with Scriptest, which is another open-source project powered by Webank. And those frontend APIs are also available for users. A client implementation is also provided as an SDK to interact directly with background services. As an highly extensible framework, users can leverage the SDK to develop their own applications.
-
-#### 2.Frontend Adaption
- Two protocols are supported for frontend APIs: HTTP and WebSocket. Compared with HTTP, Websocket is more friendly to servers and behaved more efficiently in message pushing. But WebSocket is unstable and users are easily to be disconnected by accident. So Scriptest combined both ways to adapt with Linkis. It communicates with Linkis by websocket in normal circumstances, and failover to HTTP protocol in case the Websocket connection was down.
-##### 2.1 API Specs
-Linkis has its own specs for front-backend adaption.
-
-**1).URL specs**
-```
-/api/rest_j/v1/{applicationName}/.+
-/api/rest_s/v1/{applicationName}/.+
-```
-
-- rest_j means the API is conformed to Jersey standards
-- rest_s means the API is conformed to springMVC Rest standards
-- v1 is the version of services,**The version will be upgraded with Linkis releases**
-- {applicationName} is the microservice name
-
-**2).Request specs**
-```json
-{
- "method":"/api/rest_j/v1/entrance/execute",
- "data":{},
- "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
-}
-```
-
-**3).Response specs**
-```json
-{"method":"/api/rest_j/v1/entrance/execute","status":0, "message":Success!","data":{}}
-```
-- method:Return the Restful API URL requested, basically used by websocket protocol。
-- status:Return the status info, in which -1 means login failed, 0 means succeeded, 1 means error, 2 mean validation failed, and 3 means no permission.
-- data:Return detailed data.
-- message:Return hint message of the request. If the status is not 0, this message returns error messages. At the same time 'data' may return the stack information in its 'stack' column.
-
-
-##### 2.2WebSocket API Description
-
-
-**1).Establish connection**
-
-Used to establish a WebSocket connection with Linkis.
-- API `/api/rest_j/entrance/connect`
-- HTTP Method **GET**
-- Status Code **101**
-
-**2).Request execution**
-
-Used to submit user jobs to Linkis for execution.
-- API `/api/rest_j/entrance/execute`
-- HTTP Method `POST`
-- Sample Json request body
-```json
-{
- "method":"/api/rest_j/v1/entrance/execute",
- "data":{
- "params": {
- "variable":{
- "k1":"v1"
- },
- "configuration":{
- "special":{
- "k2":"v2"
- },
- "runtime":{
- "k3":"v3"
- },
- "startup":{
- "k4":"v4"
- }
- }
- },
- "executeApplicationName":"spark",
- "executionCode":"show tables",
- "runType":"sql",
- "source":{
- "scriptPath": "/home//linkis.sql"
- },
- "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
- }
-}
-```
-- Descriptions for parameters of request body data
-
-| Parameter Name | Parameter Definition | Type | Comments |
-| ------------ | ------------ | ------------ | ------------ |
-| executeApplicationName | The Engine service expected by the user, such as Spark or hive| String | Not null |
-| requestApplicationName | The name of the system launching this request | String | Nullable |
-| params | User-defined parameters to run services | Map | Required, but values are nullable |
-| executionCode | The execution code submitted by the user | String |Not null |
-| runType | Assuming that the user executes a spark job, he may choose python, R or SQL as runType| String | Not null |
-| scriptPath | The script path of the execution code | String | For Scriptest, it shouldn't be null with executionCode at the same time |
- Table 1 Descriptions for the parameters
-
-
-- Sample Json response body
-```json
-{
- "method": "/api/rest_j/v1/entrance/execute",
- "status": 0,
- "message": "Execution request succeeded",
- "data": {
- "execID": "030418IDEhivebdpdwc010004:10087IDE_johnnwang_21",
- "taskID": "123"
- }
-}
-```
-- execID is a unique ID of String type generated for each user task after submitted to Linkis. It is only used during the execution period, like PID. The format of execID is (length of requestApplicationName)(length of executeAppName)(length of Instance)${requestApplicationName}${executeApplicationName}${entranceInstance infomation ip+port}${requestApplicationName}_${umUser}_${index}
-- taskID is a unique ID of Long type genenrated incrementally by the database for each task.
-
-**3).The push mechanism for task status, logs and progress**
-
-After submission, the status, logs and progress information will be pushed by the server. They could be retrieved by websocket protocol.
-The API is consistent with HTTP protocol as mentioned below. The only difference is that the schema of websocket is ws://, but http:// for HTTP protocol.
-
-Sample response of WebSocket API
-- Logs
-```json
-{
- "method": "/api/rest_j/v1/entrance/${execID}/log",
- "status": 0,
- "message": "Returned log information",
- "data": {
- "execID": "${execID}",
- "log": ["errorLog","warnLog","infoLog", "allLog"],
- "taskID":28594,
- "fromLine": 56
- },
- "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
-}
-```
-- Status
-```json
-{
- "method": "/api/rest_j/v1/entrance/${execID}/status",
- "status": 0,
- "message": "Return status information",
- "data": {
- "execID": "${execID}",
- "taskID":28594,
- "status": "Running",
- },
- "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
-}
-```
-- Progress
-```json
-{
- "method": "/api/rest_j/v1/entrance/${execID}/log",
- "status": 0,
- "message": "Return progress information",
- "data": {
- "execID": "${execID}",
- "taskID":28594,
- "progress": 0.2,
- "progressInfo": [
- {
- "id": "job-1",
- "succeedTasks": 2,
- "failedTasks": 0,
- "runningTasks": 5,
- "totalTasks": 10
- },
- {
- "id": "job-2",
- "succeedTasks": 5,
- "failedTasks": 0,
- "runningTasks": 5,
- "totalTasks": 10
- }
- ]
- },
- "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
-}
-```
-
-
-
-##### 2.3HTTP API description
-For HTTP API, polling should be used to retrieve the status, logs and progress information after submission.
-
-
-**1).Request execution**
-
-- API `/api/rest_j/entrance/execute`
-- HTTP Method `POST`
-- Sample JSON request body, its description is the same with Table 1
-```json
-{
- "params": {},
- "executeApplicationName":"spark",
- "executionCode":"show tables",
- "runType":"sql",
- "source":{
- "scriptPath": "/home/linkis/linkis.sql"
- }
-}
-```
-- The response is consistent with websocket. Both execId and taskId will be obtained.
-
-**2).Retrieve status**
-
-- API `/api/rest_j/entrance/${execID}/status`
-- HTTP Method `GET`
-- Sample response body
-```json
-{
- "method": "/api/rest_j/v1/entrance/{execID}/status",
- "status": 0,
- "message": "Succeeded to retrieve status",
- "data": {
- "execID": "${execID}",
- "status": "Running"
- }
-}
-```
-
-**3).Retrieve logs**
-
-- API `/api/rest_j/entrance/${execID}/log?fromLine=${fromLine}&size=${size}`
-- HTTP Method `GET`
-- Parameter fromLine specifies from which line to start. Parameter size specifies the number of lines should be retrieved for this request.
-- Sample response body, the returned fromLine indicates the value of parameter fromLine for next request.
-```json
-{
- "method": "/api/rest_j/v1/entrance/${execID}/log",
- "status": 0,
- "message": "Return logs information",
- "data": {
- "execID": "${execID}",
- "log": ["errorLogs","warnLogs","infoLogs", "allLogs],
- "fromLine": 56
- }
-}
-```
-
-**4).Retrieve progress**
-
-- API `/api/rest_j/entrance/${execID}/progress`
-- HTTP Method `GET`
-- Sample response body
-```json
-{
- "method": "/api/rest_j/v1/entrance/{execID}/progress",
- "status": 0,
- "message": "Return progress information",
- "data": {
- "execID": "${execID}",
- "progress": 0.2,
- "progressInfo": [
- {
- "id": "job-1",
- "succeedTasks": 2,
- "failedTasks": 0,
- "runningTasks": 5,
- "totalTasks": 10
- },
- {
- "id": "job-2",
- "succeedTasks": 5,
- "failedTasks": 0,
- "runningTasks": 5,
- "totalTasks": 10
- }
- ]
- }
-}
-```
-**5).kill task**
-
-- API `/api/rest_j/entrance/${execID}/kill`
-- HTTP Method `POST`
-- Sample response body
-```json
-{
- "method": "/api/rest_j/v1/entrance/{execID}/kill",
- "status": 0,
- "message": "OK",
- "data": {
- "execID":"${execID}"
- }
-}
-```
-
-
-
-### 3.Client SDK Adaption
-[Please see Linkis Quick Start](/docs/en_US/ch2/Linkis%20Quick%20Start.md)
-
-
-
-#### 4. Multiple engine type support
-Except using the engines developed by Linkis directly, backend developers can also develop their own applications based on their requirements. Divided into Entrance, EngineManager and Engine modules, one can easily split an application to adapt to Linkis. The purpose and architecture of these three modules please refer to Linkis Architect Design Docs.
-
-#### Convention
-
-Linkis uses Spring framework as the underlying technique. So instances of some classes can be injected using Spring annotations. Linkis provides some default common implementations. If customized classes are needed by users, they can be directly injected and replace the current implementations.
-
-##### 4.1Entrance module adaption
-**1)maven dependency**
-```xml
-
- com.webank.wedatasphere.linkis
- linkis-ujes-entrance
- 0.9.3
-
-```
-**2)Interfaces to be implemented**
-
-There is no compulsory interface in Entrance. Below interfaces can be implemented on demand.
-- EntranceParser. Used to parse request maps from frontend to a persistable Task. Class AbstractEntranceParser is already provided and only parseToTask method needs to be overridden. Linkis provides CommonEntranceParser as the default implementation.
-- EngineRequester. Used to build a RequestEngine object, which can be used to request a new engine from the EngineManager.
-- Scheduler. Used to schedule tasks. The default implementation provides parallel mode for multi-user situations and FIFO mode for single user pattern. It is not suggested to be customized without special purposes.
-
-##### 4.2EngineManager module adaption
-**1)maven dependency**
-```xml
-
- com.webank.wedatasphere.linkis
- linkis-ujes-enginemanager
- 0.9.3
-
-```
-
-**2)Interfaces to be implemented**
-
-Below interfaces are required to be implemented in EngineManager:
-- EngineCreator. Method createProcessEngineBuilder needs to be overridden in the existing AbstractEngineCreator to create an EngineBuilder.
-Here ProcessEngineBuilder has already provided a class called JavaProcessEngineBuilder, which is an abstract class accomplishes configurations of classpath, JavaOpts, GC file path and log path, and opening DEBUG port in test mode. To implement JavaProcessEngineBuilder, only extra classpath and JavaOpts are needed to be specified.
-- EngineResourceFactory. Method getRequestResource needs to be overridden in the existing AbstractEngineResourceFactory to declare user customized resource requirements.
-- hooks. A Spring bean used to add pre and post hooks around the Engine startup procedure. Users need to specify an Array[EngineHook] for dependency injection.
-- resources. A Spring bean used to register resources to RM. Users need to specify an instance of ModuleInfo for dependency injection.
-
-##### 4.3Engine module adaption
-**1)maven dependency**
-```xml
-
- com.webank.wedatasphere.linkis
- linkis-ujes-engine
- 0.9.3
-
-```
-**2)Interfaces to be implemented**
-
-Below interfaces are required to be implemented in Engine:
-- EngineExecutorFactory. Used to build an EngineExecutor from a Map by implementing method createExecutor.
-- EngineExecutor. The actual executor to execute the code submitted from the entrance. Methods need to be implemented: getActualUsedResources(the resource an engine acually used), executeLine(execute a line of the code parsed by CodeParser), executeCompletely(the suplementary method for executeLine. If executeLine returns ExecuteIncomplete, new code will be submitted with the previous code together to the engine)
-
-Below interfaces/beans are optional in Engine:
-- engineHooks: Array[EngineHook], a Spring bean used to add pre and post hooks around the Engine startup procedure. Currently the system provides 2 hooks: CodeGeneratorEngineHook for UDF/Function loading and ReleaseEngineHook for releasing spare engines. The system registers engineHooks=Array(ReleaseEngineHook) only by default.
-- CodeParser. Used to parse code into lines and submit one line only for each execution loop. The system registers a CodeParser returns all the code at once by default.
+## Linkis User Manual
+
+#### 1.Summary
+ Designed by Webank independently, Linkis is an extensible framework and a sophisticated solution for big data task submission. Conveniently, it could be used directly together with Scriptest, which is another open-source project powered by Webank. And those frontend APIs are also available for users. A client implementation is also provided as an SDK to interact directly with background services. As an highly extensible framework, users can leverage the SDK to develop their own applications.
+
+#### 2.Frontend Adaption
+ Two protocols are supported for frontend APIs: HTTP and WebSocket. Compared with HTTP, Websocket is more friendly to servers and behaved more efficiently in message pushing. But WebSocket is unstable and users are easily to be disconnected by accident. So Scriptest combined both ways to adapt with Linkis. It communicates with Linkis by websocket in normal circumstances, and failover to HTTP protocol in case the Websocket connection was down.
+##### 2.1 API Specs
+Linkis has its own specs for front-backend adaption.
+
+**1).URL specs**
+```
+/api/rest_j/v1/{applicationName}/.+
+/api/rest_s/v1/{applicationName}/.+
+```
+
+- rest_j means the API is conformed to Jersey standards
+- rest_s means the API is conformed to springMVC Rest standards
+- v1 is the version of services,**The version will be upgraded with Linkis releases**
+- {applicationName} is the microservice name
+
+**2).Request specs**
+```json
+{
+ "method":"/api/rest_j/v1/entrance/execute",
+ "data":{},
+ "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
+}
+```
+
+**3).Response specs**
+```json
+{"method":"/api/rest_j/v1/entrance/execute","status":0, "message":Success!","data":{}}
+```
+- method:Return the Restful API URL requested, basically used by websocket protocol。
+- status:Return the status info, in which -1 means login failed, 0 means succeeded, 1 means error, 2 mean validation failed, and 3 means no permission.
+- data:Return detailed data.
+- message:Return hint message of the request. If the status is not 0, this message returns error messages. At the same time 'data' may return the stack information in its 'stack' column.
+
+
+##### 2.2WebSocket API Description
+
+
+**1).Establish connection**
+
+Used to establish a WebSocket connection with Linkis.
+- API `/api/rest_j/entrance/connect`
+- HTTP Method **GET**
+- Status Code **101**
+
+**2).Request execution**
+
+Used to submit user jobs to Linkis for execution.
+- API `/api/rest_j/entrance/execute`
+- HTTP Method `POST`
+- Sample Json request body
+```json
+{
+ "method":"/api/rest_j/v1/entrance/execute",
+ "data":{
+ "params": {
+ "variable":{
+ "k1":"v1"
+ },
+ "configuration":{
+ "special":{
+ "k2":"v2"
+ },
+ "runtime":{
+ "k3":"v3"
+ },
+ "startup":{
+ "k4":"v4"
+ }
+ }
+ },
+ "executeApplicationName":"spark",
+ "executionCode":"show tables",
+ "runType":"sql",
+ "source":{
+ "scriptPath": "/home//linkis.sql"
+ },
+ "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
+ }
+}
+```
+- Descriptions for parameters of request body data
+
+| Parameter Name | Parameter Definition | Type | Comments |
+| ------------ | ------------ | ------------ | ------------ |
+| executeApplicationName | The Engine service expected by the user, such as Spark or hive| String | Not null |
+| requestApplicationName | The name of the system launching this request | String | Nullable |
+| params | User-defined parameters to run services | Map | Required, but values are nullable |
+| executionCode | The execution code submitted by the user | String |Not null |
+| runType | Assuming that the user executes a spark job, he may choose python, R or SQL as runType| String | Not null |
+| scriptPath | The script path of the execution code | String | For Scriptest, it shouldn't be null with executionCode at the same time |
+ Table 1 Descriptions for the parameters
+
+
+- Sample Json response body
+```json
+{
+ "method": "/api/rest_j/v1/entrance/execute",
+ "status": 0,
+ "message": "Execution request succeeded",
+ "data": {
+ "execID": "030418IDEhivebdpdwc010004:10087IDE_johnnwang_21",
+ "taskID": "123"
+ }
+}
+```
+- execID is a unique ID of String type generated for each user task after submitted to Linkis. It is only used during the execution period, like PID. The format of execID is (length of requestApplicationName)(length of executeAppName)(length of Instance)${requestApplicationName}${executeApplicationName}${entranceInstance infomation ip+port}${requestApplicationName}_${umUser}_${index}
+- taskID is a unique ID of Long type genenrated incrementally by the database for each task.
+
+**3).The push mechanism for task status, logs and progress**
+
+After submission, the status, logs and progress information will be pushed by the server. They could be retrieved by websocket protocol.
+The API is consistent with HTTP protocol as mentioned below. The only difference is that the schema of websocket is ws://, but http:// for HTTP protocol.
+
+Sample response of WebSocket API
+- Logs
+```json
+{
+ "method": "/api/rest_j/v1/entrance/${execID}/log",
+ "status": 0,
+ "message": "Returned log information",
+ "data": {
+ "execID": "${execID}",
+ "log": ["errorLog","warnLog","infoLog", "allLog"],
+ "taskID":28594,
+ "fromLine": 56
+ },
+ "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
+}
+```
+- Status
+```json
+{
+ "method": "/api/rest_j/v1/entrance/${execID}/status",
+ "status": 0,
+ "message": "Return status information",
+ "data": {
+ "execID": "${execID}",
+ "taskID":28594,
+ "status": "Running",
+ },
+ "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
+}
+```
+- Progress
+```json
+{
+ "method": "/api/rest_j/v1/entrance/${execID}/log",
+ "status": 0,
+ "message": "Return progress information",
+ "data": {
+ "execID": "${execID}",
+ "taskID":28594,
+ "progress": 0.2,
+ "progressInfo": [
+ {
+ "id": "job-1",
+ "succeedTasks": 2,
+ "failedTasks": 0,
+ "runningTasks": 5,
+ "totalTasks": 10
+ },
+ {
+ "id": "job-2",
+ "succeedTasks": 5,
+ "failedTasks": 0,
+ "runningTasks": 5,
+ "totalTasks": 10
+ }
+ ]
+ },
+ "websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
+}
+```
+
+
+
+##### 2.3HTTP API description
+For HTTP API, polling should be used to retrieve the status, logs and progress information after submission.
+
+
+**1).Request execution**
+
+- API `/api/rest_j/entrance/execute`
+- HTTP Method `POST`
+- Sample JSON request body, its description is the same with Table 1
+```json
+{
+ "params": {},
+ "executeApplicationName":"spark",
+ "executionCode":"show tables",
+ "runType":"sql",
+ "source":{
+ "scriptPath": "/home/linkis/linkis.sql"
+ }
+}
+```
+- The response is consistent with websocket. Both execId and taskId will be obtained.
+
+**2).Retrieve status**
+
+- API `/api/rest_j/entrance/${execID}/status`
+- HTTP Method `GET`
+- Sample response body
+```json
+{
+ "method": "/api/rest_j/v1/entrance/{execID}/status",
+ "status": 0,
+ "message": "Succeeded to retrieve status",
+ "data": {
+ "execID": "${execID}",
+ "status": "Running"
+ }
+}
+```
+
+**3).Retrieve logs**
+
+- API `/api/rest_j/entrance/${execID}/log?fromLine=${fromLine}&size=${size}`
+- HTTP Method `GET`
+- Parameter fromLine specifies from which line to start. Parameter size specifies the number of lines should be retrieved for this request.
+- Sample response body, the returned fromLine indicates the value of parameter fromLine for next request.
+```json
+{
+ "method": "/api/rest_j/v1/entrance/${execID}/log",
+ "status": 0,
+ "message": "Return logs information",
+ "data": {
+ "execID": "${execID}",
+ "log": ["errorLogs","warnLogs","infoLogs", "allLogs],
+ "fromLine": 56
+ }
+}
+```
+
+**4).Retrieve progress**
+
+- API `/api/rest_j/entrance/${execID}/progress`
+- HTTP Method `GET`
+- Sample response body
+```json
+{
+ "method": "/api/rest_j/v1/entrance/{execID}/progress",
+ "status": 0,
+ "message": "Return progress information",
+ "data": {
+ "execID": "${execID}",
+ "progress": 0.2,
+ "progressInfo": [
+ {
+ "id": "job-1",
+ "succeedTasks": 2,
+ "failedTasks": 0,
+ "runningTasks": 5,
+ "totalTasks": 10
+ },
+ {
+ "id": "job-2",
+ "succeedTasks": 5,
+ "failedTasks": 0,
+ "runningTasks": 5,
+ "totalTasks": 10
+ }
+ ]
+ }
+}
+```
+**5).kill task**
+
+- API `/api/rest_j/entrance/${execID}/kill`
+- HTTP Method `POST`
+- Sample response body
+```json
+{
+ "method": "/api/rest_j/v1/entrance/{execID}/kill",
+ "status": 0,
+ "message": "OK",
+ "data": {
+ "execID":"${execID}"
+ }
+}
+```
+
+
+
+### 3.Client SDK Adaption
+[Please see Linkis Quick Start](/docs/en_US/ch2/Linkis%20Quick%20Start.md)
+
+
+
+#### 4. Multiple engine type support
+Except using the engines developed by Linkis directly, backend developers can also develop their own applications based on their requirements. Divided into Entrance, EngineManager and Engine modules, one can easily split an application to adapt to Linkis. The purpose and architecture of these three modules please refer to Linkis Architect Design Docs.
+
+#### Convention
+
+Linkis uses Spring framework as the underlying technique. So instances of some classes can be injected using Spring annotations. Linkis provides some default common implementations. If customized classes are needed by users, they can be directly injected and replace the current implementations.
+
+##### 4.1Entrance module adaption
+**1)maven dependency**
+```xml
+
+ com.webank.wedatasphere.linkis
+ linkis-ujes-entrance
+ 0.9.4
+
+```
+**2)Interfaces to be implemented**
+
+There is no compulsory interface in Entrance. Below interfaces can be implemented on demand.
+- EntranceParser. Used to parse request maps from frontend to a persistable Task. Class AbstractEntranceParser is already provided and only parseToTask method needs to be overridden. Linkis provides CommonEntranceParser as the default implementation.
+- EngineRequester. Used to build a RequestEngine object, which can be used to request a new engine from the EngineManager.
+- Scheduler. Used to schedule tasks. The default implementation provides parallel mode for multi-user situations and FIFO mode for single user pattern. It is not suggested to be customized without special purposes.
+
+##### 4.2EngineManager module adaption
+**1)maven dependency**
+```xml
+
+ com.webank.wedatasphere.linkis
+ linkis-ujes-enginemanager
+ 0.9.4
+
+```
+
+**2)Interfaces to be implemented**
+
+Below interfaces are required to be implemented in EngineManager:
+- EngineCreator. Method createProcessEngineBuilder needs to be overridden in the existing AbstractEngineCreator to create an EngineBuilder.
+Here ProcessEngineBuilder has already provided a class called JavaProcessEngineBuilder, which is an abstract class accomplishes configurations of classpath, JavaOpts, GC file path and log path, and opening DEBUG port in test mode. To implement JavaProcessEngineBuilder, only extra classpath and JavaOpts are needed to be specified.
+- EngineResourceFactory. Method getRequestResource needs to be overridden in the existing AbstractEngineResourceFactory to declare user customized resource requirements.
+- hooks. A Spring bean used to add pre and post hooks around the Engine startup procedure. Users need to specify an Array[EngineHook] for dependency injection.
+- resources. A Spring bean used to register resources to RM. Users need to specify an instance of ModuleInfo for dependency injection.
+
+##### 4.3Engine module adaption
+**1)maven dependency**
+```xml
+
+ com.webank.wedatasphere.linkis
+ linkis-ujes-engine
+ 0.9.4
+
+```
+**2)Interfaces to be implemented**
+
+Below interfaces are required to be implemented in Engine:
+- EngineExecutorFactory. Used to build an EngineExecutor from a Map by implementing method createExecutor.
+- EngineExecutor. The actual executor to execute the code submitted from the entrance. Methods need to be implemented: getActualUsedResources(the resource an engine acually used), executeLine(execute a line of the code parsed by CodeParser), executeCompletely(the suplementary method for executeLine. If executeLine returns ExecuteIncomplete, new code will be submitted with the previous code together to the engine)
+
+Below interfaces/beans are optional in Engine:
+- engineHooks: Array[EngineHook], a Spring bean used to add pre and post hooks around the Engine startup procedure. Currently the system provides 2 hooks: CodeGeneratorEngineHook for UDF/Function loading and ReleaseEngineHook for releasing spare engines. The system registers engineHooks=Array(ReleaseEngineHook) only by default.
+- CodeParser. Used to parse code into lines and submit one line only for each execution loop. The system registers a CodeParser returns all the code at once by default.
- EngineParser. Used to convert a RequestTask to a Job that is acceptable by Scheduler. If not specified, the system registers an EngineParser that converts RequestTask to CommonEngineJob.
\ No newline at end of file
diff --git a/docs/en_US/ch3/Linkis_Java_SDK_doc.md b/docs/en_US/ch3/Linkis_Java_SDK_doc.md
index 244e7a4fde..487d782755 100644
--- a/docs/en_US/ch3/Linkis_Java_SDK_doc.md
+++ b/docs/en_US/ch3/Linkis_Java_SDK_doc.md
@@ -1,157 +1,157 @@
-### Linkis Java SDK Doc
-#### 1.Introduction
-
-Linkis provides a Java client implementation for users to have quick-access to Linkis background services using UJESClient.
-
-#### 2 Quick start
-
- We provided two test classes under dir ujes/client/src/test:
-
- com.webank.wedatasphere.linkis.ujes.client.UJESClientImplTestJ # Test class based on Java
- com.webank.wedatasphere.linkis.ujes.client.UJESClientImplTest # Test class based on Scala
-
- If you have cloned the source code of Linkis, you can directly run these two test classes.
-
-
- **Below sections introduce about how to write the code to complete a single execution on Linkis**
-
-#### 3 Fast implementation
-
-##### 3.1 maven dependency
-
-```xml
-
- com.webank.wedatasphere.Linkis
- Linkis-ujes-client
- 0.9.3
-
-```
-
-#### 3.2 Sample implementation
-
-- **JAVA**
-```java
-package com.webank.bdp.dataworkcloud.ujes.client;
-
-import com.webank.wedatasphere.Linkis.common.utils.Utils;
-import com.webank.wedatasphere.Linkis.httpclient.dws.authentication.StaticAuthenticationStrategy;
-import com.webank.wedatasphere.Linkis.httpclient.dws.config.DWSClientConfig;
-import com.webank.wedatasphere.Linkis.httpclient.dws.config.DWSClientConfigBuilder;
-import com.webank.wedatasphere.Linkis.ujes.client.UJESClient;
-import com.webank.wedatasphere.Linkis.ujes.client.UJESClientImpl;
-import com.webank.wedatasphere.Linkis.ujes.client.request.JobExecuteAction;
-import com.webank.wedatasphere.Linkis.ujes.client.request.ResultSetAction;
-import com.webank.wedatasphere.Linkis.ujes.client.response.JobExecuteResult;
-import com.webank.wedatasphere.Linkis.ujes.client.response.JobInfoResult;
-import com.webank.wedatasphere.Linkis.ujes.client.response.JobProgressResult;
-import com.webank.wedatasphere.Linkis.ujes.client.response.JobStatusResult;
-import org.apache.commons.io.IOUtils;
-
-import java.util.concurrent.TimeUnit;
-
-
-public class UJESClientImplTestJ{
- public static void main(String[] args){
- // 1. To do the configuration, an instance of DWSClientConfig should be obtained from DWSClientBuilder.
- DWSClientConfig clientConfig = ((DWSClientConfigBuilder) (DWSClientConfigBuilder.newBuilder()
- .addUJESServerUrl("http://${ip}:${port}") //Specify the ServerUrl,The address of Willink gateway, i.e. http://{ip}:{port}
- .connectionTimeout(30000) //connectionTimeOut: The connection timeout of the client
- .discoveryEnabled(true).discoveryFrequency(1, TimeUnit.MINUTES) //Enable service discovery. Once enabled, newly started Gateway will be auto-dicovered.
- .loadbalancerEnabled(true) // Enable load balancing. Cannot be enabled alone without service discovery enabled.
- .maxConnectionSize(5) //Max connection size, aka the max concurrent threshold
- .retryEnabled(false).readTimeout(30000) //whether to retry after failure
- .setAuthenticationStrategy(new StaticAuthenticationStrategy()) //AuthenticationStrategy, The authentication strategy of Linkis
- .setAuthTokenKey("${username}").setAuthTokenValue("${password}"))) //The authentication key,usually the username;The authentication value,usually the password
- .setDWSVersion("v1").build(); //The version of Linkis background protocol, currently v1
-
- // 2. Create a UJESClient from DWSClientConfig
- UJESClient client = new UJESClientImpl(clientConfig);
-
- // 3. Begin to execute the code
- JobExecuteResult jobExecuteResult = client.execute(JobExecuteAction.builder()
- .setCreator("LinkisClient-Test") //creator. The name of the system which holds the UJES client, used for system level isolation.
- .addExecuteCode("show tables") //ExecutionCode. The code which is requested to be executed
- .setEngineType(JobExecuteAction.EngineType$.MODULE$.HIVE()) // The engine type expected by the client, i.e. Spark, Hive, etc...
- .setUser("johnnwang") //User, The user who makes this request;Used for user level multi-tenant isolation
- .build());
- System.out.println("execId: " + jobExecuteResult.getExecID() + ", taskId: " + jobExecuteResult.taskID());
-
- // 4. Synch the status of script execution
- JobStatusResult status = client.status(jobExecuteResult);
- while(!status.isCompleted()) {
- // 5. Synch the status of script execution
- JobProgressResult progress = client.progress(jobExecuteResult);
- Utils.sleepQuietly(500);
- status = client.status(jobExecuteResult);
- }
-
- // 6. Synch the job information of script execution
- JobInfoResult jobInfo = client.getJobInfo(jobExecuteResult);
- // 7. Fetch the list of result sets(Multiple result sets will be generated if a user submitted multiple SQL at once)
- String resultSet = jobInfo.getResultSetList(client)[0];
- // 8. Fetch detailed result set content with a particular result set info
- Object fileContents = client.resultSet(ResultSetAction.builder().setPath(resultSet).setUser(jobExecuteResult.getUser()).build()).getFileContent();
- System.out.println("fileContents: " + fileContents);
- IOUtils.closeQuietly(client);
- }
-}
-```
-
-- **SCALA**
-```scala
-
-import java.util.concurrent.TimeUnit
-
-import com.webank.wedatasphere.Linkis.common.utils.Utils
-import com.webank.wedatasphere.Linkis.httpclient.dws.authentication.StaticAuthenticationStrategy
-import com.webank.wedatasphere.Linkis.httpclient.dws.config.DWSClientConfigBuilder
-import com.webank.wedatasphere.Linkis.ujes.client.request.JobExecuteAction.EngineType
-import com.webank.wedatasphere.Linkis.ujes.client.request.{JobExecuteAction, ResultSetAction}
-import org.apache.commons.io.IOUtils
-
-object UJESClientImplTest extends App {
-
- // 1. To do the configuration, an instance of DWSClientConfig should be obtained from DWSClientBuilder.
- val clientConfig = DWSClientConfigBuilder.newBuilder()
- .addUJESServerUrl("http://${ip}:${port}") //Specify the ServerUrl,The address of Willink gateway, i.e. http://{ip}:{port}
- .connectionTimeout(30000) //connectionTimeOut: The connection timeout of the client
- .discoveryEnabled(true).discoveryFrequency(1, TimeUnit.MINUTES) //Enable service discovery. Once enabled, newly started Gateway will be auto-dicovered.
- .loadbalancerEnabled(true) // Enable load balancing. Cannot be enabled alone without service discovery enabled.
- .maxConnectionSize(5) //Max connection size, aka the max concurrent threshold
- .retryEnabled(false).readTimeout(30000) //whether to retry after failure
- .setAuthenticationStrategy(new StaticAuthenticationStrategy()) //AuthenticationStrategy, The authentication strategy of Linkis
- .setAuthTokenKey("${username}").setAuthTokenValue("${password}") //The authentication key,usually the username;The authentication value,usually the password
- .setDWSVersion("v1").build() //The version of Linkis background protocol, currently v1
-
- // 2. Create a UJESClient from DWSClientConfig
- val client = UJESClient(clientConfig)
-
- // 3. Begin to execute the code
- val jobExecuteResult = client.execute(JobExecuteAction.builder()
- .setCreator("LinkisClient-Test") //creator. The name of the system which holds the UJES client, used for system level isolation.
- .addExecuteCode("show tables") //ExecutionCode. The code which is requested to be executed
- .setEngineType(EngineType.SPARK) // The engine type expected by the client, i.e. Spark, Hive, etc...
- .setUser("${username}").build()) //User, The user who makes this request;Used for user level multi-tenant isolation
- println("execId: " + jobExecuteResult.getExecID + ", taskId: " + jobExecuteResult.taskID)
-
- // 4. Synch the status of script execution
- var status = client.status(jobExecuteResult)
- while(!status.isCompleted) {
- // 5. Synch the status of script execution
- val progress = client.progress(jobExecuteResult)
- val progressInfo = if(progress.getProgressInfo != null) progress.getProgressInfo.toList else List.empty
- println("progress: " + progress.getProgress + ", progressInfo: " + progressInfo)
- Utils.sleepQuietly(500)
- status = client.status(jobExecuteResult)
- }
-
- // 6. Synch the job information of script execution
- val jobInfo = client.getJobInfo(jobExecuteResult)
- // 7. Fetch the list of result sets(Multiple result sets will be generated if a user submitted multiple SQL at once)
- val resultSet = jobInfo.getResultSetList(client).head
- // 8. Fetch detailed result set content with a particular result set info
- val fileContents = client.resultSet(ResultSetAction.builder().setPath(resultSet).setUser(jobExecuteResult.getUser).build()).getFileContent
- println("fileContents: " + fileContents)
- IOUtils.closeQuietly(client)
-}
-```
+### Linkis Java SDK Doc
+#### 1.Introduction
+
+Linkis provides a Java client implementation for users to have quick-access to Linkis background services using UJESClient.
+
+#### 2 Quick start
+
+ We provided two test classes under dir ujes/client/src/test:
+
+ com.webank.wedatasphere.linkis.ujes.client.UJESClientImplTestJ # Test class based on Java
+ com.webank.wedatasphere.linkis.ujes.client.UJESClientImplTest # Test class based on Scala
+
+ If you have cloned the source code of Linkis, you can directly run these two test classes.
+
+
+ **Below sections introduce about how to write the code to complete a single execution on Linkis**
+
+#### 3 Fast implementation
+
+##### 3.1 maven dependency
+
+```xml
+
+ com.webank.wedatasphere.Linkis
+ Linkis-ujes-client
+ 0.9.4
+
+```
+
+#### 3.2 Sample implementation
+
+- **JAVA**
+```java
+package com.webank.bdp.dataworkcloud.ujes.client;
+
+import com.webank.wedatasphere.Linkis.common.utils.Utils;
+import com.webank.wedatasphere.Linkis.httpclient.dws.authentication.StaticAuthenticationStrategy;
+import com.webank.wedatasphere.Linkis.httpclient.dws.config.DWSClientConfig;
+import com.webank.wedatasphere.Linkis.httpclient.dws.config.DWSClientConfigBuilder;
+import com.webank.wedatasphere.Linkis.ujes.client.UJESClient;
+import com.webank.wedatasphere.Linkis.ujes.client.UJESClientImpl;
+import com.webank.wedatasphere.Linkis.ujes.client.request.JobExecuteAction;
+import com.webank.wedatasphere.Linkis.ujes.client.request.ResultSetAction;
+import com.webank.wedatasphere.Linkis.ujes.client.response.JobExecuteResult;
+import com.webank.wedatasphere.Linkis.ujes.client.response.JobInfoResult;
+import com.webank.wedatasphere.Linkis.ujes.client.response.JobProgressResult;
+import com.webank.wedatasphere.Linkis.ujes.client.response.JobStatusResult;
+import org.apache.commons.io.IOUtils;
+
+import java.util.concurrent.TimeUnit;
+
+
+public class UJESClientImplTestJ{
+ public static void main(String[] args){
+ // 1. To do the configuration, an instance of DWSClientConfig should be obtained from DWSClientBuilder.
+ DWSClientConfig clientConfig = ((DWSClientConfigBuilder) (DWSClientConfigBuilder.newBuilder()
+ .addUJESServerUrl("http://${ip}:${port}") //Specify the ServerUrl,The address of Willink gateway, i.e. http://{ip}:{port}
+ .connectionTimeout(30000) //connectionTimeOut: The connection timeout of the client
+ .discoveryEnabled(true).discoveryFrequency(1, TimeUnit.MINUTES) //Enable service discovery. Once enabled, newly started Gateway will be auto-dicovered.
+ .loadbalancerEnabled(true) // Enable load balancing. Cannot be enabled alone without service discovery enabled.
+ .maxConnectionSize(5) //Max connection size, aka the max concurrent threshold
+ .retryEnabled(false).readTimeout(30000) //whether to retry after failure
+ .setAuthenticationStrategy(new StaticAuthenticationStrategy()) //AuthenticationStrategy, The authentication strategy of Linkis
+ .setAuthTokenKey("${username}").setAuthTokenValue("${password}"))) //The authentication key,usually the username;The authentication value,usually the password
+ .setDWSVersion("v1").build(); //The version of Linkis background protocol, currently v1
+
+ // 2. Create a UJESClient from DWSClientConfig
+ UJESClient client = new UJESClientImpl(clientConfig);
+
+ // 3. Begin to execute the code
+ JobExecuteResult jobExecuteResult = client.execute(JobExecuteAction.builder()
+ .setCreator("LinkisClient-Test") //creator. The name of the system which holds the UJES client, used for system level isolation.
+ .addExecuteCode("show tables") //ExecutionCode. The code which is requested to be executed
+ .setEngineType(JobExecuteAction.EngineType$.MODULE$.HIVE()) // The engine type expected by the client, i.e. Spark, Hive, etc...
+ .setUser("johnnwang") //User, The user who makes this request;Used for user level multi-tenant isolation
+ .build());
+ System.out.println("execId: " + jobExecuteResult.getExecID() + ", taskId: " + jobExecuteResult.taskID());
+
+ // 4. Synch the status of script execution
+ JobStatusResult status = client.status(jobExecuteResult);
+ while(!status.isCompleted()) {
+ // 5. Synch the status of script execution
+ JobProgressResult progress = client.progress(jobExecuteResult);
+ Utils.sleepQuietly(500);
+ status = client.status(jobExecuteResult);
+ }
+
+ // 6. Synch the job information of script execution
+ JobInfoResult jobInfo = client.getJobInfo(jobExecuteResult);
+ // 7. Fetch the list of result sets(Multiple result sets will be generated if a user submitted multiple SQL at once)
+ String resultSet = jobInfo.getResultSetList(client)[0];
+ // 8. Fetch detailed result set content with a particular result set info
+ Object fileContents = client.resultSet(ResultSetAction.builder().setPath(resultSet).setUser(jobExecuteResult.getUser()).build()).getFileContent();
+ System.out.println("fileContents: " + fileContents);
+ IOUtils.closeQuietly(client);
+ }
+}
+```
+
+- **SCALA**
+```scala
+
+import java.util.concurrent.TimeUnit
+
+import com.webank.wedatasphere.Linkis.common.utils.Utils
+import com.webank.wedatasphere.Linkis.httpclient.dws.authentication.StaticAuthenticationStrategy
+import com.webank.wedatasphere.Linkis.httpclient.dws.config.DWSClientConfigBuilder
+import com.webank.wedatasphere.Linkis.ujes.client.request.JobExecuteAction.EngineType
+import com.webank.wedatasphere.Linkis.ujes.client.request.{JobExecuteAction, ResultSetAction}
+import org.apache.commons.io.IOUtils
+
+object UJESClientImplTest extends App {
+
+ // 1. To do the configuration, an instance of DWSClientConfig should be obtained from DWSClientBuilder.
+ val clientConfig = DWSClientConfigBuilder.newBuilder()
+ .addUJESServerUrl("http://${ip}:${port}") //Specify the ServerUrl,The address of Willink gateway, i.e. http://{ip}:{port}
+ .connectionTimeout(30000) //connectionTimeOut: The connection timeout of the client
+ .discoveryEnabled(true).discoveryFrequency(1, TimeUnit.MINUTES) //Enable service discovery. Once enabled, newly started Gateway will be auto-dicovered.
+ .loadbalancerEnabled(true) // Enable load balancing. Cannot be enabled alone without service discovery enabled.
+ .maxConnectionSize(5) //Max connection size, aka the max concurrent threshold
+ .retryEnabled(false).readTimeout(30000) //whether to retry after failure
+ .setAuthenticationStrategy(new StaticAuthenticationStrategy()) //AuthenticationStrategy, The authentication strategy of Linkis
+ .setAuthTokenKey("${username}").setAuthTokenValue("${password}") //The authentication key,usually the username;The authentication value,usually the password
+ .setDWSVersion("v1").build() //The version of Linkis background protocol, currently v1
+
+ // 2. Create a UJESClient from DWSClientConfig
+ val client = UJESClient(clientConfig)
+
+ // 3. Begin to execute the code
+ val jobExecuteResult = client.execute(JobExecuteAction.builder()
+ .setCreator("LinkisClient-Test") //creator. The name of the system which holds the UJES client, used for system level isolation.
+ .addExecuteCode("show tables") //ExecutionCode. The code which is requested to be executed
+ .setEngineType(EngineType.SPARK) // The engine type expected by the client, i.e. Spark, Hive, etc...
+ .setUser("${username}").build()) //User, The user who makes this request;Used for user level multi-tenant isolation
+ println("execId: " + jobExecuteResult.getExecID + ", taskId: " + jobExecuteResult.taskID)
+
+ // 4. Synch the status of script execution
+ var status = client.status(jobExecuteResult)
+ while(!status.isCompleted) {
+ // 5. Synch the status of script execution
+ val progress = client.progress(jobExecuteResult)
+ val progressInfo = if(progress.getProgressInfo != null) progress.getProgressInfo.toList else List.empty
+ println("progress: " + progress.getProgress + ", progressInfo: " + progressInfo)
+ Utils.sleepQuietly(500)
+ status = client.status(jobExecuteResult)
+ }
+
+ // 6. Synch the job information of script execution
+ val jobInfo = client.getJobInfo(jobExecuteResult)
+ // 7. Fetch the list of result sets(Multiple result sets will be generated if a user submitted multiple SQL at once)
+ val resultSet = jobInfo.getResultSetList(client).head
+ // 8. Fetch detailed result set content with a particular result set info
+ val fileContents = client.resultSet(ResultSetAction.builder().setPath(resultSet).setUser(jobExecuteResult.getUser).build()).getFileContent
+ println("fileContents: " + fileContents)
+ IOUtils.closeQuietly(client)
+}
+```
diff --git "a/docs/zh_CN/ch2/linkis\345\277\253\351\200\237\344\275\277\347\224\250\346\226\207\346\241\243.md" "b/docs/zh_CN/ch2/linkis\345\277\253\351\200\237\344\275\277\347\224\250\346\226\207\346\241\243.md"
index 3553a9e5e9..41727944b3 100644
--- "a/docs/zh_CN/ch2/linkis\345\277\253\351\200\237\344\275\277\347\224\250\346\226\207\346\241\243.md"
+++ "b/docs/zh_CN/ch2/linkis\345\277\253\351\200\237\344\275\277\347\224\250\346\226\207\346\241\243.md"
@@ -21,7 +21,7 @@ Linkis为用户提供了Java客户端的实现,用户可以使用UJESClient对
com.webank.wedatasphere.Linkis
Linkis-ujes-client
- 0.9.3
+ 0.9.4
```
diff --git "a/docs/zh_CN/ch3/Linkis\345\246\202\344\275\225\346\216\245\345\205\245\346\226\260\347\232\204\345\272\225\345\261\202\350\256\241\347\256\227\345\255\230\345\202\250\345\274\225\346\223\216.md" "b/docs/zh_CN/ch3/Linkis\345\246\202\344\275\225\346\216\245\345\205\245\346\226\260\347\232\204\345\272\225\345\261\202\350\256\241\347\256\227\345\255\230\345\202\250\345\274\225\346\223\216.md"
index 6b3c972de2..42f3cdbc24 100644
--- "a/docs/zh_CN/ch3/Linkis\345\246\202\344\275\225\346\216\245\345\205\245\346\226\260\347\232\204\345\272\225\345\261\202\350\256\241\347\256\227\345\255\230\345\202\250\345\274\225\346\223\216.md"
+++ "b/docs/zh_CN/ch3/Linkis\345\246\202\344\275\225\346\216\245\345\205\245\346\226\260\347\232\204\345\272\225\345\261\202\350\256\241\347\256\227\345\255\230\345\202\250\345\274\225\346\223\216.md"
@@ -22,7 +22,7 @@ Linkis的底层架构非常灵活,所有的顶层接口几乎都提供了一
com.webank.wedatasphere.Linkis
Linkis-ujes-entrance
- 0.9.3
+ 0.9.4
```
@@ -42,7 +42,7 @@ Linkis的底层架构非常灵活,所有的顶层接口几乎都提供了一
com.webank.wedatasphere.Linkis
Linkis-ujes-enginemanager
- 0.9.3
+ 0.9.4
```
@@ -74,7 +74,7 @@ Linkis的底层架构非常灵活,所有的顶层接口几乎都提供了一
com.webank.wedatasphere.Linkis
Linkis-ujes-engine
- 0.9.3
+ 0.9.4
```
diff --git "a/docs/zh_CN/ch3/linkis\344\275\277\347\224\250\346\226\207\346\241\243.md" "b/docs/zh_CN/ch3/linkis\344\275\277\347\224\250\346\226\207\346\241\243.md"
index 0695c79ea6..1c61591a77 100644
--- "a/docs/zh_CN/ch3/linkis\344\275\277\347\224\250\346\226\207\346\241\243.md"
+++ "b/docs/zh_CN/ch3/linkis\344\275\277\347\224\250\346\226\207\346\241\243.md"
@@ -312,7 +312,7 @@ Linkis项目使用了Spring框架作为底层技术,所以一些类实例可
com.webank.wedatasphere.Linkis
Linkis-ujes-entrance
- 0.9.3
+ 0.9.4
```
**2)需要实现的接口**
@@ -328,7 +328,7 @@ Entrance没有必须要实例化的接口,以下接口可以根据需要进行
com.webank.wedatasphere.Linkis
Linkis-ujes-enginemanager
- 0.9.3
+ 0.9.4
```
@@ -348,7 +348,7 @@ EngineManager需要对以下接口根据需要进行实现:
com.webank.wedatasphere.Linkis
Linkis-ujes-engine
- 0.9.3
+ 0.9.4
```
**2)需要实现的接口**
diff --git a/eurekaServer/pom.xml b/eurekaServer/pom.xml
index 2f4128093c..2999d30588 100644
--- a/eurekaServer/pom.xml
+++ b/eurekaServer/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-eureka-server
diff --git a/extensions/spark-excel/pom.xml b/extensions/spark-excel/pom.xml
index 10ce736575..0c920b697d 100644
--- a/extensions/spark-excel/pom.xml
+++ b/extensions/spark-excel/pom.xml
@@ -6,7 +6,7 @@
com.webank.weDataSphere
spark-excel_2.11
- 0.9.3
+ 0.9.4
UTF-8
diff --git a/gateway/core/pom.xml b/gateway/core/pom.xml
index 26bacc8d3e..2b83561737 100644
--- a/gateway/core/pom.xml
+++ b/gateway/core/pom.xml
@@ -22,7 +22,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-gateway-core
diff --git a/gateway/gateway-httpclient-support/pom.xml b/gateway/gateway-httpclient-support/pom.xml
index ca6a715f31..dce31146f9 100644
--- a/gateway/gateway-httpclient-support/pom.xml
+++ b/gateway/gateway-httpclient-support/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-gateway-httpclient-support
diff --git a/gateway/gateway-ujes-support/pom.xml b/gateway/gateway-ujes-support/pom.xml
index 9613d47fd3..9a44a17cac 100644
--- a/gateway/gateway-ujes-support/pom.xml
+++ b/gateway/gateway-ujes-support/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-gateway-ujes-support
diff --git a/gateway/springcloudgateway/pom.xml b/gateway/springcloudgateway/pom.xml
index 15de471629..068c01c5a5 100644
--- a/gateway/springcloudgateway/pom.xml
+++ b/gateway/springcloudgateway/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-gateway-springcloudgateway
diff --git a/metadata/pom.xml b/metadata/pom.xml
index 42dcc78826..d4a05f473d 100644
--- a/metadata/pom.xml
+++ b/metadata/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
jar
diff --git a/pom.xml b/pom.xml
index 35d08eb761..79b182cef7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
com.webank.wedatasphere.linkis
linkis
- 0.9.3
+ 0.9.4
pom
Linkis Project Parent POM
@@ -134,7 +134,7 @@
9.4.11.v20180605
4.5.4
1.7.12
- 0.9.3
+ 0.9.4
3.3.3
UTF-8
0.11.2
@@ -238,7 +238,7 @@
true
- 0.9.3
+ 0.9.4
4.1.17.Final
3.5.3
@@ -246,7 +246,7 @@
spark2.3
- 0.9.3
+ 0.9.4
4.1.17.Final
3.2.11
@@ -254,7 +254,7 @@
spark2.2-2.0
- 0.9.3
+ 0.9.4
4.0.47.Final
3.2.11
diff --git a/publicService/application/pom.xml b/publicService/application/pom.xml
index 01af0feeef..7e921f7643 100644
--- a/publicService/application/pom.xml
+++ b/publicService/application/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-application
@@ -47,7 +47,7 @@
com.webank.wedatasphere.linkis
linkis-storage
- 0.9.3
+ 0.9.4
provided
diff --git a/publicService/configuration/pom.xml b/publicService/configuration/pom.xml
index 3150bd4ff9..7fae3ee568 100644
--- a/publicService/configuration/pom.xml
+++ b/publicService/configuration/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-configuration
diff --git a/publicService/jobhistory/pom.xml b/publicService/jobhistory/pom.xml
index 195f3cb161..43421fcaa1 100644
--- a/publicService/jobhistory/pom.xml
+++ b/publicService/jobhistory/pom.xml
@@ -24,7 +24,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-jobhistory
diff --git a/publicService/pom.xml b/publicService/pom.xml
index 5168a7063d..53617f2515 100644
--- a/publicService/pom.xml
+++ b/publicService/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/publicService/udf/pom.xml b/publicService/udf/pom.xml
index 137c5eaeea..5320cfe31a 100644
--- a/publicService/udf/pom.xml
+++ b/publicService/udf/pom.xml
@@ -21,7 +21,7 @@
com.webank.wedatasphere.linkis
linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/publicService/variable/pom.xml b/publicService/variable/pom.xml
index 16b2a48f94..97c38b28cf 100644
--- a/publicService/variable/pom.xml
+++ b/publicService/variable/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-variable
diff --git a/publicService/workspace/client/workspace-httpclient/pom.xml b/publicService/workspace/client/workspace-httpclient/pom.xml
index ec446371b7..967e45f3b8 100644
--- a/publicService/workspace/client/workspace-httpclient/pom.xml
+++ b/publicService/workspace/client/workspace-httpclient/pom.xml
@@ -7,7 +7,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-workspace-httpclient
diff --git a/publicService/workspace/pom.xml b/publicService/workspace/pom.xml
index 3d937529d2..8a5b98daae 100644
--- a/publicService/workspace/pom.xml
+++ b/publicService/workspace/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-workspace
jar
diff --git a/resourceManager/resourcemanagerclient/pom.xml b/resourceManager/resourcemanagerclient/pom.xml
index 7f9341f145..fda5b9ca7d 100644
--- a/resourceManager/resourcemanagerclient/pom.xml
+++ b/resourceManager/resourcemanagerclient/pom.xml
@@ -20,7 +20,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/resourceManager/resourcemanagercommon/pom.xml b/resourceManager/resourcemanagercommon/pom.xml
index 051cec5c1f..25e0b3ffef 100644
--- a/resourceManager/resourcemanagercommon/pom.xml
+++ b/resourceManager/resourcemanagercommon/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/resourceManager/resourcemanagerserver/pom.xml b/resourceManager/resourcemanagerserver/pom.xml
index a02e0bae80..848acf9e1b 100644
--- a/resourceManager/resourcemanagerserver/pom.xml
+++ b/resourceManager/resourcemanagerserver/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/storage/pesIO/io-engine/pom.xml b/storage/pesIO/io-engine/pom.xml
index 718e279cf7..2daa412cb3 100644
--- a/storage/pesIO/io-engine/pom.xml
+++ b/storage/pesIO/io-engine/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/storage/pesIO/io-enginemanager/pom.xml b/storage/pesIO/io-enginemanager/pom.xml
index 8d585629d7..10bd4caa7c 100644
--- a/storage/pesIO/io-enginemanager/pom.xml
+++ b/storage/pesIO/io-enginemanager/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/storage/pesIO/io-entrance/pom.xml b/storage/pesIO/io-entrance/pom.xml
index 233bb4860b..a5c66f663c 100644
--- a/storage/pesIO/io-entrance/pom.xml
+++ b/storage/pesIO/io-entrance/pom.xml
@@ -20,7 +20,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/storage/storage/pom.xml b/storage/storage/pom.xml
index 19302dd605..f12d217ae1 100644
--- a/storage/storage/pom.xml
+++ b/storage/storage/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/ujes/client/pom.xml b/ujes/client/pom.xml
index b1f1b673ac..a293cfd068 100644
--- a/ujes/client/pom.xml
+++ b/ujes/client/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-client
diff --git a/ujes/definedEngines/hive/engine/pom.xml b/ujes/definedEngines/hive/engine/pom.xml
index 68260f23f7..54357a87e5 100644
--- a/ujes/definedEngines/hive/engine/pom.xml
+++ b/ujes/definedEngines/hive/engine/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/hive/enginemanager/pom.xml b/ujes/definedEngines/hive/enginemanager/pom.xml
index 84c66a43fd..949d601a41 100644
--- a/ujes/definedEngines/hive/enginemanager/pom.xml
+++ b/ujes/definedEngines/hive/enginemanager/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/hive/entrance/pom.xml b/ujes/definedEngines/hive/entrance/pom.xml
index b39b7c1f1a..bb771d41e1 100644
--- a/ujes/definedEngines/hive/entrance/pom.xml
+++ b/ujes/definedEngines/hive/entrance/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/jdbc/entrance/pom.xml b/ujes/definedEngines/jdbc/entrance/pom.xml
index 582c39ab9e..ba17552dda 100644
--- a/ujes/definedEngines/jdbc/entrance/pom.xml
+++ b/ujes/definedEngines/jdbc/entrance/pom.xml
@@ -22,7 +22,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
@@ -77,7 +77,7 @@
org.apache.thrift
libthrift
- 0.9.3
+ 0.9.4
pom
diff --git a/ujes/definedEngines/mlsql/entrance/pom.xml b/ujes/definedEngines/mlsql/entrance/pom.xml
index 62f924d1bd..31d60e783c 100644
--- a/ujes/definedEngines/mlsql/entrance/pom.xml
+++ b/ujes/definedEngines/mlsql/entrance/pom.xml
@@ -5,7 +5,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/pipeline/engine/pom.xml b/ujes/definedEngines/pipeline/engine/pom.xml
index 956cac82b0..67c2155380 100644
--- a/ujes/definedEngines/pipeline/engine/pom.xml
+++ b/ujes/definedEngines/pipeline/engine/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/ujes/definedEngines/pipeline/enginemanager/pom.xml b/ujes/definedEngines/pipeline/enginemanager/pom.xml
index 7efdddbc56..1aea5d59b9 100644
--- a/ujes/definedEngines/pipeline/enginemanager/pom.xml
+++ b/ujes/definedEngines/pipeline/enginemanager/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/ujes/definedEngines/pipeline/entrance/pom.xml b/ujes/definedEngines/pipeline/entrance/pom.xml
index ca5f811711..cc95e786ef 100644
--- a/ujes/definedEngines/pipeline/entrance/pom.xml
+++ b/ujes/definedEngines/pipeline/entrance/pom.xml
@@ -21,7 +21,7 @@
4.0.0
- 0.9.3
+ 0.9.4
com.webank.wedatasphere.linkis
linkis
diff --git a/ujes/definedEngines/python/engine/pom.xml b/ujes/definedEngines/python/engine/pom.xml
index 33b6fba552..a08864540c 100644
--- a/ujes/definedEngines/python/engine/pom.xml
+++ b/ujes/definedEngines/python/engine/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-python-engine
diff --git a/ujes/definedEngines/python/enginemanager/pom.xml b/ujes/definedEngines/python/enginemanager/pom.xml
index 9e623b97cf..cac5209654 100644
--- a/ujes/definedEngines/python/enginemanager/pom.xml
+++ b/ujes/definedEngines/python/enginemanager/pom.xml
@@ -23,17 +23,17 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-python-enginemanager
- 0.9.3
+ 0.9.4
jar
- 0.9.3
+ 0.9.4
diff --git a/ujes/definedEngines/python/entrance/pom.xml b/ujes/definedEngines/python/entrance/pom.xml
index b06dae1a9a..0e1b31a078 100644
--- a/ujes/definedEngines/python/entrance/pom.xml
+++ b/ujes/definedEngines/python/entrance/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-python-entracne
diff --git a/ujes/definedEngines/shell/engine/pom.xml b/ujes/definedEngines/shell/engine/pom.xml
index f18edefe01..f9f2129a14 100644
--- a/ujes/definedEngines/shell/engine/pom.xml
+++ b/ujes/definedEngines/shell/engine/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/shell/enginemanager/pom.xml b/ujes/definedEngines/shell/enginemanager/pom.xml
index 4987448bbb..8e821e28a6 100644
--- a/ujes/definedEngines/shell/enginemanager/pom.xml
+++ b/ujes/definedEngines/shell/enginemanager/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/shell/entrance/pom.xml b/ujes/definedEngines/shell/entrance/pom.xml
index 40f9f50178..1c6765b911 100644
--- a/ujes/definedEngines/shell/entrance/pom.xml
+++ b/ujes/definedEngines/shell/entrance/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/definedEngines/spark/engine/pom.xml b/ujes/definedEngines/spark/engine/pom.xml
index 92fcda873b..704c9110a2 100644
--- a/ujes/definedEngines/spark/engine/pom.xml
+++ b/ujes/definedEngines/spark/engine/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-spark-engine
diff --git a/ujes/definedEngines/spark/enginemanager/pom.xml b/ujes/definedEngines/spark/enginemanager/pom.xml
index d10aec39ed..ae8a3b488f 100644
--- a/ujes/definedEngines/spark/enginemanager/pom.xml
+++ b/ujes/definedEngines/spark/enginemanager/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-spark-enginemanager
diff --git a/ujes/definedEngines/spark/entrance/pom.xml b/ujes/definedEngines/spark/entrance/pom.xml
index 7641bd5f88..070592a12f 100644
--- a/ujes/definedEngines/spark/entrance/pom.xml
+++ b/ujes/definedEngines/spark/entrance/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-spark-entracne
diff --git a/ujes/definedEngines/tispark/engine/pom.xml b/ujes/definedEngines/tispark/engine/pom.xml
index 09723524bd..0e334bb3a9 100644
--- a/ujes/definedEngines/tispark/engine/pom.xml
+++ b/ujes/definedEngines/tispark/engine/pom.xml
@@ -21,7 +21,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
4.0.0
diff --git a/ujes/engine/pom.xml b/ujes/engine/pom.xml
index 387ce2ddbb..9fa05dbcbb 100644
--- a/ujes/engine/pom.xml
+++ b/ujes/engine/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-engine
diff --git a/ujes/enginemanager/pom.xml b/ujes/enginemanager/pom.xml
index 196f1dbe7c..9843ac997c 100644
--- a/ujes/enginemanager/pom.xml
+++ b/ujes/enginemanager/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-enginemanager
diff --git a/ujes/entrance/pom.xml b/ujes/entrance/pom.xml
index 575430f5cc..90294dcacb 100644
--- a/ujes/entrance/pom.xml
+++ b/ujes/entrance/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-entrance
diff --git a/ujes/entranceclient/pom.xml b/ujes/entranceclient/pom.xml
index 01158a663d..0657ff0d72 100644
--- a/ujes/entranceclient/pom.xml
+++ b/ujes/entranceclient/pom.xml
@@ -23,7 +23,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-entranceclient
diff --git a/ujes/jdbc/pom.xml b/ujes/jdbc/pom.xml
index 15239041db..ebbdfee216 100644
--- a/ujes/jdbc/pom.xml
+++ b/ujes/jdbc/pom.xml
@@ -7,7 +7,7 @@
linkis
com.webank.wedatasphere.linkis
- 0.9.3
+ 0.9.4
linkis-ujes-jdbc
@@ -15,7 +15,7 @@
com.webank.wedatasphere.linkis
linkis-ujes-client
- 0.9.3
+ 0.9.4
diff --git a/userControl/pom.xml b/userControl/pom.xml
index fca67462c4..67c41c11b2 100644
--- a/userControl/pom.xml
+++ b/userControl/pom.xml
@@ -21,7 +21,7 @@
com.webank.wedatasphere.linkis
linkis
- 0.9.3
+ 0.9.4
4.0.0
From cc7fb728a9765f31a54d86bda3d518769f508d23 Mon Sep 17 00:00:00 2001
From: johnnywang
Date: Wed, 3 Jun 2020 17:48:41 +0800
Subject: [PATCH 2/8] Update pom.xml
---
ujes/definedEngines/jdbc/entrance/pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ujes/definedEngines/jdbc/entrance/pom.xml b/ujes/definedEngines/jdbc/entrance/pom.xml
index ba17552dda..0f214b667c 100644
--- a/ujes/definedEngines/jdbc/entrance/pom.xml
+++ b/ujes/definedEngines/jdbc/entrance/pom.xml
@@ -77,7 +77,7 @@
org.apache.thrift
libthrift
- 0.9.4
+ 0.9.3
pom
@@ -139,4 +139,4 @@
${project.artifactId}-${project.version}
-
\ No newline at end of file
+
From cddd08eb4fcec9142caecfdabdf147c355543ba2 Mon Sep 17 00:00:00 2001
From: johnnywang
Date: Wed, 3 Jun 2020 17:52:48 +0800
Subject: [PATCH 3/8] Update pom.xml
Remove useless properties
---
ujes/definedEngines/python/enginemanager/pom.xml | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/ujes/definedEngines/python/enginemanager/pom.xml b/ujes/definedEngines/python/enginemanager/pom.xml
index cac5209654..b81d0f3cad 100644
--- a/ujes/definedEngines/python/enginemanager/pom.xml
+++ b/ujes/definedEngines/python/enginemanager/pom.xml
@@ -32,9 +32,6 @@
-
- 0.9.4
-
@@ -128,4 +125,4 @@
-
\ No newline at end of file
+
From 2badadf6345bee2405be9cfe517f2c124a0944e1 Mon Sep 17 00:00:00 2001
From: yangzhiyue <904666286@qq.com>
Date: Wed, 3 Jun 2020 20:44:12 +0800
Subject: [PATCH 4/8] add context service client
---
contextservice/cs-client/pom.xml | 104 ++++
.../cs/client/AbstractContextClient.java | 9 +
.../linkis/cs/client/Context.java | 83 +++
.../linkis/cs/client/ContextClient.java | 120 ++++
.../linkis/cs/client/LinkisContext.java | 9 +
.../cs/client/LinkisWorkFlowContext.java | 134 ++++
.../client/builder/ContextClientConfig.java | 9 +
.../client/builder/ContextClientFactory.java | 29 +
.../builder/HttpContextClientConfig.java | 60 ++
.../builder/RPCHttpContextClientConfig.java | 8 +
.../client/http/ContextPostActionBuilder.java | 64 ++
.../cs/client/http/HttpContextClient.java | 588 ++++++++++++++++++
.../cs/client/http/HttpHeartBeater.java | 141 +++++
.../client/listener/ContextClientEvent.java | 11 +
.../listener/ContextClientListener.java | 14 +
.../listener/ContextClientListenerBus.java | 32 +
.../ContextClientListenerManager.java | 25 +
.../cs/client/listener/ContextIDListener.java | 75 +++
.../client/listener/ContextKeyListener.java | 68 ++
.../client/listener/ContextUpdateEvent.java | 8 +
.../cs/client/listener/HeartBeater.java | 21 +
.../cs/client/service/CSMetaDataService.java | 54 ++
.../cs/client/service/CSNodeService.java | 23 +
.../cs/client/service/CSNodeServiceImpl.java | 63 ++
.../cs/client/service/CSResourceService.java | 75 +++
.../client/service/CSResultDataService.java | 32 +
.../service/CSResultDataServiceImpl.java | 109 ++++
.../cs/client/service/CSTableService.java | 205 ++++++
.../cs/client/service/CSVariableService.java | 94 +++
.../cs/client/service/CSWorkService.java | 30 +
.../cs/client/service/CSWorkServiceImpl.java | 93 +++
.../client/service/DefaultSearchService.java | 147 +++++
.../client/service/LinkisJobDataService.java | 30 +
.../service/LinkisJobDataServiceImpl.java | 88 +++
.../cs/client/service/MetaDataService.java | 25 +
.../cs/client/service/ResourceService.java | 26 +
.../cs/client/service/SearchService.java | 39 ++
.../cs/client/service/TableService.java | 59 ++
.../cs/client/service/VariableService.java | 30 +
.../cs/client/utils/ContextServiceUtils.java | 192 ++++++
.../cs/client/utils/ExceptionHelper.java | 15 +
.../cs/client/utils/SerializeHelper.java | 63 ++
.../exception/ProtocolNotMatchException.scala | 9 +
.../linkis/cs/client/http/ContextAction.scala | 97 +++
.../linkis/cs/client/http/ContextResult.scala | 113 ++++
.../cs/client/utils/ContextClientConf.scala | 47 ++
.../cs/client/utils/ContextClientUtils.scala | 18 +
.../client/utils/ContextServerHttpConf.scala | 65 ++
.../linkis/cs/client/test/Test.java | 113 ++++
.../test/bean/ClientTestContextKey.java | 68 ++
.../test/bean/ClientTestContextValue.java | 37 ++
.../client/test/bean/ResourceValueBean.java | 34 +
.../listener/CommonContextKeyListener.java | 30 +
.../cs/client/test/restful/ListenerTest.java | 8 +
.../cs/client/test/restful/RestfulTest.java | 92 +++
.../cs/client/test/service/TestInfo.java | 83 +++
.../cs/client/test/service/TestRemove.java | 114 ++++
.../test/service/TestSearchService.java | 112 ++++
.../test_multiuser/TestChangeContext.java | 94 +++
.../test_multiuser/TestCreateContext.java | 91 +++
60 files changed, 4329 insertions(+)
create mode 100644 contextservice/cs-client/pom.xml
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/AbstractContextClient.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/Context.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/ContextClient.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisContext.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisWorkFlowContext.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientConfig.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientFactory.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/HttpContextClientConfig.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/RPCHttpContextClientConfig.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/ContextPostActionBuilder.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpContextClient.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpHeartBeater.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextClientEvent.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextClientListener.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextClientListenerBus.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextClientListenerManager.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextIDListener.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextKeyListener.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/ContextUpdateEvent.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/listener/HeartBeater.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSMetaDataService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSNodeService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSNodeServiceImpl.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSResourceService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSResultDataService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSResultDataServiceImpl.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSTableService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSVariableService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSWorkService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/CSWorkServiceImpl.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/DefaultSearchService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/LinkisJobDataService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/LinkisJobDataServiceImpl.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/MetaDataService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/ResourceService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/SearchService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/TableService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/service/VariableService.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/utils/ContextServiceUtils.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/utils/ExceptionHelper.java
create mode 100644 contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/utils/SerializeHelper.java
create mode 100644 contextservice/cs-client/src/main/scala/com/webank/wedatasphere/linkis/cs/client/exception/ProtocolNotMatchException.scala
create mode 100644 contextservice/cs-client/src/main/scala/com/webank/wedatasphere/linkis/cs/client/http/ContextAction.scala
create mode 100644 contextservice/cs-client/src/main/scala/com/webank/wedatasphere/linkis/cs/client/http/ContextResult.scala
create mode 100644 contextservice/cs-client/src/main/scala/com/webank/wedatasphere/linkis/cs/client/utils/ContextClientConf.scala
create mode 100644 contextservice/cs-client/src/main/scala/com/webank/wedatasphere/linkis/cs/client/utils/ContextClientUtils.scala
create mode 100644 contextservice/cs-client/src/main/scala/com/webank/wedatasphere/linkis/cs/client/utils/ContextServerHttpConf.scala
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/Test.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/bean/ClientTestContextKey.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/bean/ClientTestContextValue.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/bean/ResourceValueBean.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/listener/CommonContextKeyListener.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/restful/ListenerTest.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/restful/RestfulTest.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/service/TestInfo.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/service/TestRemove.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/service/TestSearchService.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/test_multiuser/TestChangeContext.java
create mode 100644 contextservice/cs-client/src/test/java/com/webank/wedatasphere/linkis/cs/client/test/test_multiuser/TestCreateContext.java
diff --git a/contextservice/cs-client/pom.xml b/contextservice/cs-client/pom.xml
new file mode 100644
index 0000000000..eff02ce3e9
--- /dev/null
+++ b/contextservice/cs-client/pom.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+ linkis
+ com.webank.wedatasphere.linkis
+ 0.9.4
+ ../../pom.xml
+
+ 4.0.0
+
+ linkis-cs-client
+
+
+
+ com.webank.wedatasphere.linkis
+ linkis-common
+ ${linkis.version}
+
+
+
+ com.webank.wedatasphere.linkis
+ linkis-gateway-httpclient-support
+ ${linkis.version}
+
+
+ com.webank.wedatasphere.linkis
+ linkis-storage
+
+
+
+
+
+ com.webank.wedatasphere.linkis
+ linkis-httpclient
+ ${linkis.version}
+
+
+
+ com.webank.wedatasphere.linkis
+ linkis-cs-common
+ ${linkis.version}
+
+
+
+
+
+
+
+
+
+ com.webank.wedatasphere.linkis
+ linkis-cs-listener
+ ${linkis.version}
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+
+
+ net.alchim31.maven
+ scala-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+
+ ${basedir}/src/main/resources
+
+
+
+
+
\ No newline at end of file
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/AbstractContextClient.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/AbstractContextClient.java
new file mode 100644
index 0000000000..53ad3c4261
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/AbstractContextClient.java
@@ -0,0 +1,9 @@
+package com.webank.wedatasphere.linkis.cs.client;
+
+/**
+ * created by cooperyang on 2020/2/11
+ * Description:
+ */
+public abstract class AbstractContextClient implements ContextClient{
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/Context.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/Context.java
new file mode 100644
index 0000000000..4226d43344
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/Context.java
@@ -0,0 +1,83 @@
+package com.webank.wedatasphere.linkis.cs.client;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextIDListener;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextKeyListener;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextScope;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextType;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextID;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextKey;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextKeyValue;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextValue;
+
+import java.util.List;
+
+
+/**
+ * created by cooperyang on 2020/2/10
+ * Description:Context是一个接口让用户能够在微服务中进行对一个工作流的Context进行操作
+ * 他应该有一个默认的实现,比如LinkisWorkFlowContext
+ */
+public interface Context {
+
+ /**
+ * 每一个Context都应该有一个ContextID与之对应d
+ * @return contextID是该Context对应的ContextID
+ */
+ public ContextID getContextID();
+
+ /**
+ * 设置ContextID
+ * @param contextID contextID
+ */
+ public void setContextID(ContextID contextID);
+
+ /**
+ * 通过contextKey来获取对应的contextValue
+ * @param contextKey 是标识一个ContextValue的一个key值,比如资源文件的名称
+ * @return 返回key对应的value, 比如resourceid 和 version
+ */
+ public ContextValue getContextValue(ContextKey contextKey) throws ErrorException;
+
+ /**
+ * 设置contextKeyValue
+ * @param contextKeyAndValue 需要设置的ContextKeyValue
+ * @throws ErrorException 可能由于网络原因出现的
+ */
+
+ public void setContextKeyAndValue(ContextKeyValue contextKeyAndValue) throws ErrorException;
+
+
+
+ public void set(ContextKey contextKey, ContextValue contextValue) throws ErrorException;
+
+ public void setLocal(ContextKey contextKey, ContextValue contextValue);
+
+ public void setLocal(ContextKeyValue contextKeyValue);
+
+ /**
+ * todo 是通过ContextCondition进行搜索
+ * @return
+ */
+ public List searchContext(List contextTypes,
+ List contextScopes,
+ List contains,
+ List regex) throws ErrorException;
+
+
+ public void reset(ContextKey contextKey) throws ErrorException;
+
+ public void reset() throws ErrorException;
+
+
+ public void remove(ContextKey contextKey) throws ErrorException;
+
+ public void removeAll()throws ErrorException;
+
+ public void onBind(ContextIDListener contextIDListener) throws ErrorException;
+
+ public void onBind(ContextKey contextKey, ContextKeyListener contextKeyListener) throws ErrorException;
+
+
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/ContextClient.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/ContextClient.java
new file mode 100644
index 0000000000..cc9b431fe4
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/ContextClient.java
@@ -0,0 +1,120 @@
+package com.webank.wedatasphere.linkis.cs.client;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextIDListener;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextKeyListener;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextScope;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextType;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextID;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextKey;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextKeyValue;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextValue;
+
+import java.io.Closeable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * created by cooperyang on 2020/2/10
+ * Description:
+ */
+public interface ContextClient extends Closeable {
+ /**
+ * 通过与cs-server进行交互生成一个工作流的Context
+ * 传入的信息应该有工程名 工作流名
+ * user是传入的用户名
+ * @return 用户可以使用的Context
+ */
+ @Deprecated
+ Context createContext(String projectName, String flowName, String use, Map params) throws ErrorException;
+
+
+ Context createContext(ContextID contextID) throws ErrorException;
+
+
+ /**
+ * 通过ContextID获取
+ * @param contextID
+ * @return
+ * @throws ErrorException
+ */
+ Context getContext(ContextID contextID) throws ErrorException;
+
+ Context getContext(String contextIDStr) throws ErrorException;
+
+ ContextValue getContextValue(ContextID contextID, ContextKey contextKey) throws ErrorException;
+
+
+
+ void update(ContextID contextID, ContextKey contextKey, ContextValue contextValue) throws ErrorException;
+
+
+ /**
+ * 通过contextID和contextKey进行对某一个contextKey进行reset
+ * @param contextID contextId
+ * @param contextKey contexKey
+ * @throws ErrorException 可能捕获的异常
+ */
+ void reset(ContextID contextID, ContextKey contextKey) throws ErrorException;
+
+
+ /**
+ * 将整个contextID所有的contextKey进行reset,这个会用在工作流实时执行之前的一个reset
+ * @param contextID contextID
+ * @throws ErrorException
+ */
+ void reset(ContextID contextID) throws ErrorException;
+
+
+
+
+
+ /**
+ * 删除的操作是为了能够将contextid下面的contextkey进行删除
+ * 如果contextKey是空的话,则全部删除
+ * @param contextID
+ * @param contextKey
+ * @throws ErrorException
+ */
+ void remove(ContextID contextID, ContextKey contextKey) throws ErrorException;
+
+ void setContextKeyValue(ContextID contextID, ContextKeyValue contextKeyValue) throws ErrorException;
+
+ void bindContextIDListener(ContextIDListener contextIDListener) throws ErrorException;
+
+ void bindContextKeyListener(ContextKeyListener contextKeyListener) throws ErrorException;
+
+ /**
+ * 通过各种condition搜索contextkeyValue
+ * @return 一个contextKeyValue数组
+ * @throws ErrorException 可能出现的error
+ */
+ List search(ContextID contextID, List contextTypes,
+ List contextScopes,
+ List contains,
+ List regex) throws ErrorException;
+
+ /**
+ * 通过各种condition搜索contextkeyValue
+ * upstreamOnly 表示取跟当前节点上游中查询
+ * nodeName 获取该节点的关系节点
+ * num 获取的节点数量,1 返回最近的一个, 无穷大表示所有节点
+ * @return 一个contextKeyValue数组
+ * @throws ErrorException 可能出现的error
+ */
+ List search(ContextID contextID, List contextTypes,
+ List contextScopes,
+ List contains,
+ List regex,
+ boolean upstreamOnly,
+ String nodeName,
+ int num,
+ List contextValueTypes) throws ErrorException;
+
+
+
+ void removeAllValueByKeyPrefixAndContextType(ContextID contextID, ContextType contextType, String keyPrefix) throws ErrorException;
+
+ void removeAllValueByKeyPrefix(ContextID contextID, String keyPrefix) throws ErrorException;
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisContext.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisContext.java
new file mode 100644
index 0000000000..565d6f1dec
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisContext.java
@@ -0,0 +1,9 @@
+package com.webank.wedatasphere.linkis.cs.client;
+
+/**
+ * created by cooperyang on 2020/2/17
+ * Description:
+ */
+public abstract class LinkisContext implements Context{
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisWorkFlowContext.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisWorkFlowContext.java
new file mode 100644
index 0000000000..ccc0eecd78
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/LinkisWorkFlowContext.java
@@ -0,0 +1,134 @@
+package com.webank.wedatasphere.linkis.cs.client;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextIDListener;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextKeyListener;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextScope;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextType;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.*;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * created by cooperyang on 2020/2/17
+ * Description:
+ */
+public class LinkisWorkFlowContext extends LinkisContext{
+
+ private ContextID contextID;
+
+ private ContextClient contextClient;
+
+ private String user;
+
+
+ private Map keyValues = new ConcurrentHashMap<>();
+
+ @Override
+ public ContextID getContextID() {
+ return this.contextID;
+ }
+
+ @Override
+ public void setContextID(ContextID contextID) {
+ this.contextID = contextID;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ @Override
+ public ContextValue getContextValue(ContextKey contextKey) throws ErrorException{
+ if(keyValues.containsKey(contextKey)){
+ return keyValues.get(contextKey);
+ }else{
+ return this.contextClient.getContextValue(this.contextID, contextKey);
+ }
+ }
+
+
+ @Override
+ public void setContextKeyAndValue(ContextKeyValue contextKeyValue) throws ErrorException{
+ //todo 这个地方是为了进行一次缓存 不过有待商榷
+ //this.setLocal(contextKeyValue);
+ this.contextClient.setContextKeyValue(this.contextID, contextKeyValue);
+ }
+
+ @Override
+ public void set(ContextKey contextKey, ContextValue contextValue) throws ErrorException{
+ setLocal(contextKey, contextValue);
+ ContextKeyValue contextKeyValue = new CommonContextKeyValue();
+ contextKeyValue.setContextKey(contextKey);
+ contextKeyValue.setContextValue(contextValue);
+ this.setContextKeyAndValue(contextKeyValue);
+ }
+
+
+ @Override
+ public void setLocal(ContextKey contextKey, ContextValue contextValue) {
+ this.keyValues.put(contextKey, contextValue);
+ }
+
+ @Override
+ public void setLocal(ContextKeyValue contextKeyValue) {
+ this.keyValues.put(contextKeyValue.getContextKey(), contextKeyValue.getContextValue());
+ }
+
+ @Override
+ public List searchContext(List contextTypes,
+ List contextScopes,
+ List contains,
+ List regex) throws ErrorException {
+ return this.contextClient.search(contextID, contextTypes, contextScopes, contains, regex);
+ }
+
+
+ @Override
+ public void reset(ContextKey contextKey) throws ErrorException{
+ this.contextClient.reset(contextID, contextKey);
+ }
+
+ @Override
+ public void reset() throws ErrorException {
+ this.contextClient.reset(this.contextID);
+ }
+
+ @Override
+ public void remove(ContextKey contextKey) throws ErrorException{
+ this.contextClient.remove(contextID, contextKey);
+ }
+
+ @Override
+ public void removeAll()throws ErrorException {
+ this.contextClient.remove(contextID, null);
+ }
+
+ @Override
+ public void onBind(ContextIDListener contextIDListener) throws ErrorException{
+ contextIDListener.setContextID(this.contextID);
+ contextIDListener.setContext(this);
+ this.contextClient.bindContextIDListener(contextIDListener);
+ }
+
+ @Override
+ public void onBind(ContextKey contextKey, ContextKeyListener contextKeyListener) throws ErrorException {
+ contextKeyListener.setContextKey(contextKey);
+ contextKeyListener.setContext(this);
+ this.contextClient.bindContextKeyListener(contextKeyListener);
+ }
+
+ public ContextClient getContextClient() {
+ return contextClient;
+ }
+
+ public void setContextClient(ContextClient contextClient) {
+ this.contextClient = contextClient;
+ }
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientConfig.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientConfig.java
new file mode 100644
index 0000000000..1818bd37f9
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientConfig.java
@@ -0,0 +1,9 @@
+package com.webank.wedatasphere.linkis.cs.client.builder;
+
+/**
+ * created by cooperyang on 2020/2/10
+ * Description:
+ */
+public abstract class ContextClientConfig {
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientFactory.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientFactory.java
new file mode 100644
index 0000000000..889af65013
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/ContextClientFactory.java
@@ -0,0 +1,29 @@
+package com.webank.wedatasphere.linkis.cs.client.builder;
+
+import com.webank.wedatasphere.linkis.cs.client.ContextClient;
+import com.webank.wedatasphere.linkis.cs.client.http.HttpContextClient;
+
+/**
+ * created by cooperyang on 2020/2/10
+ * Description:
+ */
+public class ContextClientFactory {
+
+
+ private static final ContextClientConfig DEFAULT_CONTEXT_CLIENT_CONFIG;
+
+ static{
+ DEFAULT_CONTEXT_CLIENT_CONFIG = new HttpContextClientConfig();
+ }
+
+ public static ContextClient getOrCreateContextClient(){
+ return getOrCreateContextClient(DEFAULT_CONTEXT_CLIENT_CONFIG);
+ }
+
+ public static ContextClient getOrCreateContextClient(ContextClientConfig contextClientConfig){
+ return HttpContextClient.getInstance(contextClientConfig);
+ }
+
+
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/HttpContextClientConfig.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/HttpContextClientConfig.java
new file mode 100644
index 0000000000..962527a631
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/HttpContextClientConfig.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.cs.client.builder;
+
+import com.webank.wedatasphere.linkis.common.conf.Configuration;
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextClientConf;
+import com.webank.wedatasphere.linkis.httpclient.authentication.AuthenticationStrategy;
+import com.webank.wedatasphere.linkis.httpclient.config.ClientConfig;
+import com.webank.wedatasphere.linkis.httpclient.config.ClientConfigBuilder;
+import com.webank.wedatasphere.linkis.httpclient.dws.authentication.TokenAuthenticationStrategy;
+
+/**
+ * created by cooperyang on 2020/2/10
+ * Description: 以http的方式和cs-server进行交互的配置,包括http的诸多配置
+ */
+public class HttpContextClientConfig extends ContextClientConfig{
+
+
+ private ClientConfig clientConfig;
+
+
+ public HttpContextClientConfig(){
+ //初始化clientConfig
+ String gatewayUrl = Configuration.getGateWayURL();
+ AuthenticationStrategy authenticationStrategy = new TokenAuthenticationStrategy();
+ int maxConnection = 10;
+ int connectionTimeout = 3000;
+ int readTimeout = 10000;
+ clientConfig = ClientConfigBuilder.newBuilder().addUJESServerUrl(gatewayUrl).
+ connectionTimeout(connectionTimeout).discoveryEnabled(false).loadbalancerEnabled(false).
+ maxConnectionSize(maxConnection).retryEnabled(false).readTimeout(readTimeout)
+ .setAuthenticationStrategy(authenticationStrategy).setAuthTokenKey(ContextClientConf.CONTEXT_CLIENT_AUTH_KEY().getValue())
+ .setAuthTokenValue(ContextClientConf.CONTEXT_CLIENT_AUTH_VALUE().getValue()).build();
+
+ }
+
+
+
+ /**
+ *
+ * @return 返回一个的
+ */
+ public ClientConfig getClientConfig(){
+ return this.clientConfig;
+ }
+
+
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/RPCHttpContextClientConfig.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/RPCHttpContextClientConfig.java
new file mode 100644
index 0000000000..fdd3b1ab12
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/builder/RPCHttpContextClientConfig.java
@@ -0,0 +1,8 @@
+package com.webank.wedatasphere.linkis.cs.client.builder;
+
+/**
+ * created by cooperyang on 2020/2/10
+ * Description:
+ */
+public class RPCHttpContextClientConfig {
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/ContextPostActionBuilder.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/ContextPostActionBuilder.java
new file mode 100644
index 0000000000..576eec10f7
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/ContextPostActionBuilder.java
@@ -0,0 +1,64 @@
+package com.webank.wedatasphere.linkis.cs.client.http;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.cs.client.utils.SerializeHelper;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextID;
+import com.webank.wedatasphere.linkis.cs.common.protocol.ContextHTTPConstant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by v_wbjftang on 2020/3/4.
+ */
+public class ContextPostActionBuilder {
+
+ private final DefaultContextPostAction action;
+
+ private Map requestParams = new HashMap(4);
+ private Map headerParams = new HashMap<>(2);
+
+ public ContextPostActionBuilder(String url) {
+ action = new DefaultContextPostAction(url);
+ }
+
+ public static ContextPostActionBuilder of(String url) {
+ return new ContextPostActionBuilder(url);
+ }
+
+ public ContextPostActionBuilder with(ContextID contextID) throws ErrorException {
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ requestParams.put(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ return this;
+ }
+
+
+ public ContextPostActionBuilder with(String key, Object object) throws ErrorException {
+ requestParams.put(key, object);
+ return this;
+ }
+
+ public ContextPostActionBuilder addHeader(String key, String value) throws ErrorException {
+ headerParams.put(key, value);
+ return this;
+ }
+
+ /* public ContextPostActionBuilder with(ContextKey contextKey) {
+ return this;
+ }
+
+ public ContextPostActionBuilder with(ContextKeyValue keyValue) {
+ return this;
+ }
+
+ public ContextPostActionBuilder with(ContextValue value) {
+ return this;
+ }*/
+
+ public DefaultContextPostAction build() {
+ action.getRequestPayloads().putAll(requestParams);
+ action.getHeaders().putAll(headerParams);
+ return action;
+ }
+
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpContextClient.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpContextClient.java
new file mode 100644
index 0000000000..c4c47c7a0d
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpContextClient.java
@@ -0,0 +1,588 @@
+package com.webank.wedatasphere.linkis.cs.client.http;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.cs.client.AbstractContextClient;
+import com.webank.wedatasphere.linkis.cs.client.Context;
+import com.webank.wedatasphere.linkis.cs.client.LinkisWorkFlowContext;
+import com.webank.wedatasphere.linkis.cs.client.builder.ContextClientConfig;
+import com.webank.wedatasphere.linkis.cs.client.builder.HttpContextClientConfig;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextIDListener;
+import com.webank.wedatasphere.linkis.cs.client.listener.ContextKeyListener;
+import com.webank.wedatasphere.linkis.cs.client.listener.HeartBeater;
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextClientConf;
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextServerHttpConf;
+import com.webank.wedatasphere.linkis.cs.client.utils.ExceptionHelper;
+import com.webank.wedatasphere.linkis.cs.client.utils.SerializeHelper;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextScope;
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.ContextType;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.*;
+import com.webank.wedatasphere.linkis.cs.common.exception.CSErrorException;
+import com.webank.wedatasphere.linkis.cs.common.protocol.ContextHTTPConstant;
+import com.webank.wedatasphere.linkis.cs.common.search.ContextSearchConditionMapBuilder;
+import com.webank.wedatasphere.linkis.httpclient.config.ClientConfig;
+import com.webank.wedatasphere.linkis.httpclient.dws.DWSHttpClient;
+import com.webank.wedatasphere.linkis.httpclient.dws.config.DWSClientConfig;
+import com.webank.wedatasphere.linkis.httpclient.dws.response.DWSResult;
+import com.webank.wedatasphere.linkis.httpclient.request.Action;
+import com.webank.wedatasphere.linkis.httpclient.response.Result;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * created by cooperyang on 2020/2/11
+ * Description: HttpContextClient是ContextClient的使用Http方式进行通信的具体实现
+ * 一般可以将其做成单例
+ */
+public class HttpContextClient extends AbstractContextClient {
+
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(HttpContextClient.class);
+
+ private DWSHttpClient dwsHttpClient;
+ private ContextClientConfig contextClientConfig;
+ private final String linkis_version = ContextClientConf.LINKIS_WEB_VERSION().getValue();
+
+ private final String name = "HttpContextClient";
+
+ private static HttpContextClient httpContextClient;
+
+ private HeartBeater heartBeater;
+
+
+
+
+ private HttpContextClient(){
+
+ }
+
+ private HttpContextClient(ContextClientConfig contextClientConfig){
+ //初始化dwsHttpClient
+ this.contextClientConfig = contextClientConfig;
+ if (contextClientConfig instanceof HttpContextClientConfig){
+ HttpContextClientConfig httpContextClientConfig = (HttpContextClientConfig)contextClientConfig;
+ ClientConfig clientConfig = httpContextClientConfig.getClientConfig();
+ DWSClientConfig dwsClientConfig = new DWSClientConfig(clientConfig);
+ dwsClientConfig.setDWSVersion(linkis_version);
+ dwsHttpClient = new DWSHttpClient(dwsClientConfig, name);
+ }
+ if ("true".equals(ContextClientConf.HEART_BEAT_ENABLED().getValue())){
+ this.heartBeater = new HttpHeartBeater(contextClientConfig);
+ heartBeater.start();
+ }
+ }
+
+
+ public static HttpContextClient getInstance(ContextClientConfig contextClientConfig){
+ if (httpContextClient == null){
+ synchronized (HttpContextClient.class){
+ if (httpContextClient == null){
+ httpContextClient = new HttpContextClient(contextClientConfig);
+ }
+ }
+ }
+ return httpContextClient;
+ }
+
+
+ @Override
+ @Deprecated
+ public Context createContext(String projectName, String flowName, String user, Map params) throws ErrorException{
+ ContextCreateAction contextCreateAction = new ContextCreateAction();
+ LinkisHAWorkFlowContextID contextID = new LinkisHAWorkFlowContextID();
+ contextID.setProject(projectName);
+ contextID.setFlow(flowName);
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ contextCreateAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextCreateAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextCreateAction);
+ }catch(Exception e) {
+ LOGGER.error("create context failed", e);
+ ExceptionHelper.throwErrorException(80015, "create context failed", e);
+ }
+ if (result instanceof ContextCreateResult){
+ ContextCreateResult contextCreateResult = (ContextCreateResult)result;
+ int status = contextCreateResult.getStatus();
+ if (status != 0){
+ String errMsg = contextCreateResult.getMessage();
+ LOGGER.error("create context for project {}, flow {} failed, msg is {}", projectName, flowName, errMsg);
+ throw new ErrorException(80014, "create context failed" + errMsg);
+ }else{
+ LinkisWorkFlowContext context = new LinkisWorkFlowContext();
+ Map map = contextCreateResult.getData();
+ contextID.setContextId(map.get("contextId").toString());
+ context.setContextID(contextID);
+ context.setContextClient(this);
+ context.setUser(user);
+ return context;
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+
+ @Override
+ public Context createContext(ContextID contextID) throws ErrorException {
+ ContextCreateAction contextCreateAction = new ContextCreateAction();
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ contextCreateAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextCreateAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextCreateAction);
+ }catch(Exception e) {
+ LOGGER.error("create context failed", e);
+ ExceptionHelper.throwErrorException(80015, "create context failed", e);
+ }
+ if (result instanceof ContextCreateResult){
+ ContextCreateResult contextCreateResult = (ContextCreateResult)result;
+ int status = contextCreateResult.getStatus();
+ if (status != 0){
+ String errMsg = contextCreateResult.getMessage();
+ LOGGER.error("create context failed, msg is {}", errMsg);
+ throw new ErrorException(80014, "create context failed" + errMsg);
+ }else{
+ LinkisWorkFlowContext context = new LinkisWorkFlowContext();
+ Map map = contextCreateResult.getData();
+ contextID.setContextId(map.get("contextId").toString());
+ context.setContextID(contextID);
+ context.setContextClient(this);
+ return context;
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public Context getContext(ContextID contextId) throws ErrorException{
+ LinkisWorkFlowContext context = new LinkisWorkFlowContext();
+ context.setContextID(contextId);
+ context.setContextClient(this);
+ return context;
+ }
+
+ @Override
+ public Context getContext(String contextIDStr) throws ErrorException {
+ ContextID contextID = SerializeHelper.deserializeContextID(contextIDStr);
+ return getContext(contextID);
+ }
+
+ @Override
+ public ContextValue getContextValue(ContextID contextID, ContextKey contextKey) throws ErrorException {
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ String contextKeyStr = SerializeHelper.serializeContextKey(contextKey);
+ ContextGetValueAction contextGetValueAction = new ContextGetValueAction();
+ contextGetValueAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextGetValueAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextGetValueAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_KEY_STR, contextKeyStr);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextGetValueAction);
+ }catch(Exception e) {
+ LOGGER.error("get context value id: {} , key: {} failed", contextIDStr, contextKeyStr, e);
+ ExceptionHelper.throwErrorException(80015, "get context value failed", e);
+ }
+ if (result instanceof ContextGetValueResult){
+ ContextGetValueResult contextGetValueResult = (ContextGetValueResult)result;
+ int status = contextGetValueResult.getStatus();
+ if (status != 0){
+ String errMsg = contextGetValueResult.getMessage();
+ LOGGER.error("get context value id: {} , key: {} failed, msg is {}", contextIDStr, contextKeyStr, errMsg);
+ throw new ErrorException(80014, "create context failed" + errMsg);
+ }else{
+ Map map = contextGetValueResult.getData();
+ if( null == map || null == map.get("contextValue") ){
+ return null;
+ }
+ String contextValueStr = map.get("contextValue").toString();
+ return SerializeHelper.deserializeContextValue(contextValueStr);
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+
+ @Override
+ public void update(ContextID contextID, ContextKey contextKey, ContextValue contextValue) throws ErrorException {
+ String contextIdStr = SerializeHelper.SERIALIZE_HELPER.serialize(contextID);
+ String contextKeyValueStr = SerializeHelper.SERIALIZE_HELPER.serialize(new CommonContextKeyValue(contextKey, contextValue));
+ ContextSetKeyValueAction contextSetKeyValueAction = new ContextSetKeyValueAction();
+ contextSetKeyValueAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIdStr);
+ contextSetKeyValueAction.getRequestPayloads().put("contextID", contextIdStr);
+ contextSetKeyValueAction.getRequestPayloads().put("contextKeyValue", contextKeyValueStr);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextSetKeyValueAction);
+ }catch(Exception e) {
+ LOGGER.error("update context failed", e);
+ ExceptionHelper.throwErrorException(80015, "update context failed", e);
+ }
+ if (result instanceof ContextSetKeyValueResult){
+ ContextSetKeyValueResult contextSetKeyValueResult = (ContextSetKeyValueResult)result;
+ int status = contextSetKeyValueResult.getStatus();
+ if (status != 0){
+ String errMsg = contextSetKeyValueResult.getMessage();
+ LOGGER.error("调用客户端去更新contextId {} 失败, 返回的错误信息是 {} ", contextIdStr, errMsg);
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public void reset(ContextID contextID, ContextKey contextKey) throws ErrorException{
+ String contextIdStr = SerializeHelper.SERIALIZE_HELPER.serialize(contextID);
+ String contextKeyStr = SerializeHelper.SERIALIZE_HELPER.serialize(contextKey);
+ ContextResetValueAction contextResetValueAction = new ContextResetValueAction();
+ contextResetValueAction.getRequestPayloads().put("contextKey", contextKeyStr);
+ contextResetValueAction.getRequestPayloads().put("contextID", contextIdStr);
+ // contextResetValueAction.getParameters().put("contextId", contextID.getContextId());
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextResetValueAction);
+ }catch(Exception e) {
+ LOGGER.error("reset contextID {}, contextKey {} failed", contextIdStr, contextKeyStr, e);
+ ExceptionHelper.throwErrorException(80015, "reset context failed", e);
+ }
+ if (result instanceof ContextResetResult){
+ ContextResetResult contextResetResult = (ContextResetResult)result;
+ int status = contextResetResult.getStatus();
+ if (status != 0){
+ String errMsg = contextResetResult.getMessage();
+ LOGGER.error("调用客户端去reset contextId {}, contextKey {} 失败, 返回的错误信息是 {} ", contextIdStr, contextKeyStr,errMsg);
+ throw new ErrorException(80015, "reset contextID failed");
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public void reset(ContextID contextID) throws ErrorException {
+ String contextIdStr = SerializeHelper.serializeContextID(contextID);
+ ContextResetIDAction contextResetIDAction = new ContextResetIDAction();
+ contextResetIDAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIdStr);
+ //contextResetIDAction.getParameters().put("contextId", contextID.getContextId());
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextResetIDAction);
+ }catch(Exception e) {
+ LOGGER.error("reset contextID {} failed", contextIdStr, e);
+ ExceptionHelper.throwErrorException(80015, "reset context failed", e);
+ }
+ if (result instanceof ContextResetIDResult){
+ ContextResetIDResult contextResetResult = (ContextResetIDResult)result;
+ int status = contextResetResult.getStatus();
+ if (status != 0){
+ String errMsg = contextResetResult.getMessage();
+ LOGGER.error("调用客户端去reset contextId {} 失败, 返回的错误信息是 {} ", contextIdStr,errMsg);
+ throw new ErrorException(80015, "reset contextID failed");
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public void remove(ContextID contextID, ContextKey contextKey) throws ErrorException{
+ String contextIdStr = SerializeHelper.serializeContextID(contextID);
+ String contextKeyStr = SerializeHelper.serializeContextKey(contextKey);
+ ContextRemoveAction contextRemoveAction = new ContextRemoveAction(contextIdStr, contextKeyStr);
+ contextRemoveAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIdStr);
+ contextRemoveAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_KEY_STR, contextKeyStr);
+ contextRemoveAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIdStr);
+ contextRemoveAction.getRequestPayloads().put("contextId", contextID.getContextId());
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextRemoveAction);
+ }catch(Exception e) {
+ LOGGER.error("remove context id {} context key {} failed", contextIdStr, contextIdStr, e);
+ ExceptionHelper.throwErrorException(80015, "remove context failed", e);
+ }
+ if (result instanceof ContextRemoveResult){
+ ContextRemoveResult contextRemoveResult = (ContextRemoveResult)result;
+ int status = contextRemoveResult.getStatus();
+ if (status != 0){
+ String errMsg = contextRemoveResult.getMessage();
+ LOGGER.error("remove context failed contextID {}, contextKey {} ", contextIdStr, contextKey.getKey());
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public void setContextKeyValue(ContextID contextID, ContextKeyValue contextKeyValue) throws ErrorException {
+ String contextIDStr = SerializeHelper.SERIALIZE_HELPER.serialize(contextID);
+ String contextKeyValueStr = SerializeHelper.SERIALIZE_HELPER.serialize(contextKeyValue);
+ ContextSetKeyValueAction action = new ContextSetKeyValueAction();
+ action.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ action.getRequestPayloads().put("contextID", contextIDStr);
+ action.getRequestPayloads().put("contextKeyValue", contextKeyValueStr);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(action);
+ }catch(Exception e) {
+ LOGGER.error("set value failed", e);
+ ExceptionHelper.throwErrorException(80015, "update context failed", e);
+ }
+ if (result instanceof ContextSetKeyValueResult){
+ ContextSetKeyValueResult contextSetKeyValueResult = (ContextSetKeyValueResult)result;
+ int status = contextSetKeyValueResult.getStatus();
+ if (status != 0){
+ String errMsg = contextSetKeyValueResult.getMessage();
+ LOGGER.error("set value failed {} ,err is {}", contextIDStr, errMsg);
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public void bindContextIDListener(ContextIDListener contextIDListener) throws ErrorException{
+ ContextID contextID = contextIDListener.getContextID();
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ ContextBindIDAction contextBindIDAction = new ContextBindIDAction();
+ contextBindIDAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ // contextBindIDAction.getParameters().put("contextId", contextID.getContextId());
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextBindIDAction);
+ }catch(Exception e) {
+ LOGGER.error("bind context id {} failed", contextIDStr, e);
+ ExceptionHelper.throwErrorException(80015, "bind context id failed", e);
+ }
+ if (result instanceof ContextBindIDResult){
+ ContextBindIDResult contextBindIDResult = (ContextBindIDResult)result;
+ int status = contextBindIDResult.getStatus();
+ if (status != 0){
+ String errMsg = contextBindIDResult.getMessage();
+ LOGGER.error("bind context id failed {} ,err is {}", contextIDStr, errMsg);
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public void bindContextKeyListener(ContextKeyListener contextKeyListener) throws ErrorException{
+ ContextID contextID = contextKeyListener.getContext().getContextID();
+ ContextKey contextKey =contextKeyListener.getContextKey();
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ String contextKeyStr = SerializeHelper.serializeContextKey(contextKey);
+ ContextBindKeyAction contextBindKeyAction = new ContextBindKeyAction();
+ contextBindKeyAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextBindKeyAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextBindKeyAction.getRequestPayloads().put(ContextHTTPConstant.CONTEXT_KEY_STR, contextKeyStr);
+ //todo 这里要改一下source的来历
+ contextBindKeyAction.getRequestPayloads().put("source", name);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextBindKeyAction);
+ }catch(Exception e) {
+ LOGGER.error("bind context id {} context key {} failed", contextIDStr, contextKeyStr, e);
+ ExceptionHelper.throwErrorException(80015, "bind context key failed", e);
+ }
+ if (result instanceof ContextBindKeyResult){
+ ContextBindKeyResult contextBindKeyResult = (ContextBindKeyResult)result;
+ int status = contextBindKeyResult.getStatus();
+ if (status != 0){
+ String errMsg = contextBindKeyResult.getMessage();
+ LOGGER.error("bind context id {} context key {} failed ,err is {}", contextIDStr, contextKeyStr, errMsg);
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ }
+
+ @Override
+ public List search(ContextID contextID,
+ List contextTypes,
+ List contextScopes,
+ List contains,
+ List regex) throws ErrorException {
+ return search(contextID, contextTypes, contextScopes, contains, regex, false, null, Integer.MAX_VALUE, null);
+ }
+
+ @Override
+ public List search(ContextID contextID,
+ List contextTypes,
+ List contextScopes,
+ List contains,
+ List regex,
+ boolean upstream,
+ String nodeName,
+ int num,
+ List contextValueTypes) throws ErrorException {
+ ContextSearchConditionMapBuilder builder = ContextSearchConditionMapBuilder.newBuilder();
+ if (contextTypes != null){
+ contextTypes.forEach(builder::contextTypes);
+ }
+ if (contextScopes != null){
+ contextScopes.forEach(builder::contextScopes);
+ }
+ if (contains != null){
+ contains.forEach(builder::contains);
+ }
+ if (regex != null){
+ regex.forEach(builder::regex);
+ }
+ builder.nearest(nodeName, num, upstream);
+ if (contextValueTypes != null) {
+ contextValueTypes.forEach(builder::contextValueTypes);
+ }
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ ContextSearchContextAction contextSearchContextAction = new ContextSearchContextAction();
+ contextSearchContextAction.addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr);
+ contextSearchContextAction.getRequestPayloads().put("condition", builder.build());
+ contextSearchContextAction.getRequestPayloads().put("contextID", contextIDStr);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextSearchContextAction);
+ }catch(Exception e) {
+ LOGGER.error("search condition failed", e);
+ ExceptionHelper.throwErrorException(80015, "search condition failed", e);
+ }
+ if (result instanceof ContextSearchResult){
+ ContextSearchResult contextSearchResult = (ContextSearchResult)result;
+ int status = contextSearchResult.getStatus();
+ if (status != 0){
+ String errMsg = contextSearchResult.getMessage();
+ LOGGER.error("search condition failed, err is {}", errMsg);
+ }else{
+ Map data = contextSearchResult.getData();
+ if(data.get("contextKeyValue") != null){
+ List retKvs = new ArrayList<>();
+ Object o = data.get("contextKeyValue");
+ List list = (List)o;
+ list.stream().map(s -> {
+ try{
+ return SerializeHelper.deserializeContextKeyValue(s);
+ }catch(ErrorException e){
+ LOGGER.error("failed to deserialize {} to a contextKeyValue", s, e);
+ return null;
+ }
+ }).filter(Objects::nonNull).forEach(retKvs::add);
+ return retKvs;
+ }
+ }
+ }else if (result != null){
+ LOGGER.error("result is not a correct type, result type is {}", result.getClass().getSimpleName());
+ throw new ErrorException(80015, "result is not a correct type");
+ }else{
+ LOGGER.error("result is null");
+ throw new ErrorException(80015, "result is null");
+ }
+ return null;
+ }
+
+
+
+ @Override
+ public void removeAllValueByKeyPrefixAndContextType(ContextID contextID, ContextType contextType, String keyPrefix) throws ErrorException {
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ DefaultContextPostAction action = ContextPostActionBuilder.of(ContextServerHttpConf.removeAllValueByKeyPrefixAndContextTypeURL())
+ .with(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr).with(ContextHTTPConstant.CONTEXT_KEY_TYPE_STR, contextType.toString())
+ .with(ContextHTTPConstant.CONTEXT_KEY_PREFIX_STR, keyPrefix).addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr).build();
+ checkDWSResult(execute(action));
+ }
+
+ @Override
+ public void removeAllValueByKeyPrefix(ContextID contextID, String keyPrefix) throws ErrorException {
+ String contextIDStr = SerializeHelper.serializeContextID(contextID);
+ DefaultContextPostAction action = ContextPostActionBuilder.of(ContextServerHttpConf.removeAllValueByKeyPrefixURL())
+ .with(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr).with(ContextHTTPConstant.CONTEXT_KEY_PREFIX_STR, keyPrefix)
+ .addHeader(ContextHTTPConstant.CONTEXT_ID_STR, contextIDStr).build();
+ checkDWSResult(execute(action));
+ }
+
+ private Result execute(Action action) throws ErrorException {
+ try{
+ return dwsHttpClient.execute(action);
+ }catch(Exception e) {
+ LOGGER.error("execute failed", e);
+ ExceptionHelper.throwErrorException(80015, "execute failed", e);
+ }
+ return null;
+ }
+
+ private DWSResult checkDWSResult(Result result) throws CSErrorException {
+ if(result instanceof DWSResult){
+ int status = ((DWSResult) result).getStatus();
+ if (status != 0){
+ String errMsg = ((DWSResult) result).getMessage();
+ LOGGER.error("request failed, err is {}", errMsg);
+ throw new CSErrorException(80015,errMsg);
+ }else {
+ return (DWSResult)result;
+ }
+ }else {
+ throw new CSErrorException(80015,"resulet is not instance of DWSResult");
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ try{
+ LOGGER.info("client close");
+ if (null != this.dwsHttpClient){
+ this.dwsHttpClient.close();
+ this.heartBeater.close();
+ }
+ } catch (Exception e){
+ LOGGER.error("Failed to close httpContextClient", e);
+ throw new IOException(e);
+ }
+
+ }
+}
diff --git a/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpHeartBeater.java b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpHeartBeater.java
new file mode 100644
index 0000000000..ddee61cad8
--- /dev/null
+++ b/contextservice/cs-client/src/main/java/com/webank/wedatasphere/linkis/cs/client/http/HttpHeartBeater.java
@@ -0,0 +1,141 @@
+package com.webank.wedatasphere.linkis.cs.client.http;
+
+import com.webank.wedatasphere.linkis.common.exception.ErrorException;
+import com.webank.wedatasphere.linkis.common.listener.Event;
+import com.webank.wedatasphere.linkis.common.utils.Utils;
+import com.webank.wedatasphere.linkis.cs.client.builder.ContextClientConfig;
+import com.webank.wedatasphere.linkis.cs.client.builder.HttpContextClientConfig;
+import com.webank.wedatasphere.linkis.cs.client.listener.*;
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextClientConf;
+import com.webank.wedatasphere.linkis.cs.client.utils.SerializeHelper;
+import com.webank.wedatasphere.linkis.cs.common.entity.source.*;
+import com.webank.wedatasphere.linkis.cs.listener.callback.imp.ContextKeyValueBean;
+import com.webank.wedatasphere.linkis.cs.listener.event.enumeration.OperateType;
+import com.webank.wedatasphere.linkis.cs.listener.event.impl.DefaultContextKeyEvent;
+import com.webank.wedatasphere.linkis.httpclient.config.ClientConfig;
+import com.webank.wedatasphere.linkis.httpclient.dws.DWSHttpClient;
+import com.webank.wedatasphere.linkis.httpclient.dws.config.DWSClientConfig;
+import com.webank.wedatasphere.linkis.httpclient.dws.response.DWSResult;
+import com.webank.wedatasphere.linkis.httpclient.response.Result;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * created by cooperyang on 2020/2/18
+ * Description: heartbeater类的作用是为了csclient能够和csserver进行每秒钟交互的一个类,从server中获取内容,
+ * 然后封装成事件投递到 事件总线,来让监听器进行消费
+ */
+public class HttpHeartBeater implements HeartBeater {
+
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(HttpHeartBeater.class);
+
+ private ContextClientListenerBus contextClientListenerBus =
+ ContextClientListenerManager.getContextClientListenerBus();
+
+ private final String name = "ContextClientHTTPHeatBeater";
+
+ //todo 要改成某一个微服务的标识
+ private final String client_source = "TestClient";
+
+
+ private DWSHttpClient dwsHttpClient;
+
+
+
+ public HttpHeartBeater(ContextClientConfig contextClientConfig){
+ if (contextClientConfig instanceof HttpContextClientConfig){
+ HttpContextClientConfig httpContextClientConfig = (HttpContextClientConfig)contextClientConfig;
+ ClientConfig clientConfig = httpContextClientConfig.getClientConfig();
+ DWSClientConfig dwsClientConfig = new DWSClientConfig(clientConfig);
+ dwsClientConfig.setDWSVersion(ContextClientConf.LINKIS_WEB_VERSION().getValue());
+ dwsHttpClient = new DWSHttpClient(dwsClientConfig, name);
+ }
+ }
+
+
+
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void heartBeat() {
+ ContextHeartBeatAction contextHeartBeatAction = new ContextHeartBeatAction(client_source);
+ contextHeartBeatAction.getRequestPayloads().put("source", client_source);
+ Result result = null;
+ try{
+ result = dwsHttpClient.execute(contextHeartBeatAction);
+ }catch(Exception e){
+ LOGGER.error("执行heartbeat出现失败", e);
+ return ;
+ }
+ if (result instanceof ContextHeartBeatResult){
+ ContextHeartBeatResult contextHeartBeatResult = (ContextHeartBeatResult)result;
+ Map data = contextHeartBeatResult.getData();
+ Object object = data.get("ContextKeyValueBean");
+ List kvBeans = new ArrayList<>();
+ if (object instanceof List){
+ List
com.webank.wedatasphere.linkis
linkis-bmlclient
diff --git a/bml/bml-engine-hook/src/main/scala/com/webank/wedatasphere/linkis/bml/hook/BmlEnginePreExecuteHook.scala b/bml/bml-engine-hook/src/main/scala/com/webank/wedatasphere/linkis/bml/hook/BmlEnginePreExecuteHook.scala
index 28f3cc0403..22ed4b4cc7 100644
--- a/bml/bml-engine-hook/src/main/scala/com/webank/wedatasphere/linkis/bml/hook/BmlEnginePreExecuteHook.scala
+++ b/bml/bml-engine-hook/src/main/scala/com/webank/wedatasphere/linkis/bml/hook/BmlEnginePreExecuteHook.scala
@@ -41,14 +41,12 @@ class BmlEnginePreExecuteHook extends EnginePreExecuteHook with Logging{
val pathType:String = "file://"
- override def callPreExecuteHook(engineExecutorContext: EngineExecutorContext, executeRequest: ExecuteRequest): Unit = {
- //1.删除工作目录以前的资源文件
- //2.下载资源到当前进程的工作目录
-
+ override def callPreExecuteHook(engineExecutorContext: EngineExecutorContext, executeRequest: ExecuteRequest, code: String): String = {
val workDir = BmlHookUtils.getCurrentWorkDir
val jobId = engineExecutorContext.getJobId
executeRequest match {
case resourceExecuteRequest:ResourceExecuteRequest => val resources = resourceExecuteRequest.resources
+ if (null == resources) return code
resources foreach {
case resource:util.Map[String, Object] => val fileName = resource.get(FILE_NAME_STR).toString
val resourceId = resource.get(RESOURCE_ID_STR).toString
@@ -74,5 +72,6 @@ class BmlEnginePreExecuteHook extends EnginePreExecuteHook with Logging{
}
case _ =>
}
+ if (StringUtils.isNotBlank(code)) code else executeRequest.code
}
}
diff --git a/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/AbstractBmlClient.java b/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/AbstractBmlClient.java
index 48ccd27fb3..5b9620f201 100644
--- a/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/AbstractBmlClient.java
+++ b/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/AbstractBmlClient.java
@@ -23,7 +23,7 @@
*/
public abstract class AbstractBmlClient implements BmlClient{
protected String user;
- protected java.util.Map properties;
+ protected Map properties;
public String getUser() {
return user;
diff --git a/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/BmlClient.java b/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/BmlClient.java
index 144592615a..e8d5a55210 100644
--- a/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/BmlClient.java
+++ b/bml/bmlclient/src/main/java/com/webank/wedatasphere/linkis/bml/client/BmlClient.java
@@ -91,4 +91,11 @@ public interface BmlClient {
public BmlResourceVersionsResponse getVersions(String user, String resourceId);
+ /**
+ *
+ */
+ public BmlDeleteResponse deleteResource(String user, String resourceId, String version);
+
+ public BmlDeleteResponse deleteResource(String user, String resourceId);
+
}
diff --git a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/client/impl/HttpBmlClient.scala b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/client/impl/HttpBmlClient.scala
index 76d3dc7ba6..e7d63672a4 100644
--- a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/client/impl/HttpBmlClient.scala
+++ b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/client/impl/HttpBmlClient.scala
@@ -290,6 +290,31 @@ class HttpBmlClient extends AbstractBmlClient{
}
+ /**
+ *
+ */
+ override def deleteResource(user: String, resourceId: String, version: String): BmlDeleteResponse = {
+ null
+ }
+
+ override def deleteResource(user: String, resourceId: String): BmlDeleteResponse = {
+ val deleteAction = BmlDeleteAction(resourceId)
+ deleteAction.getParameters.put("resourceId", resourceId)
+ val result = dwsClient.execute(deleteAction)
+ result match {
+ case bmlDeleteResult: BmlDeleteResult => val isSuccess= if (bmlDeleteResult.getStatus == 0) true else false
+ if (isSuccess){
+ BmlDeleteResponse(isSuccess)
+ }else{
+ logger.error(s"user $user update resource failed, status code is ${bmlDeleteResult.getStatusCode}")
+ BmlDeleteResponse(isSuccess)
+ }
+ case r:BmlResult => logger.error(s"result type ${r.getResultType} not match BmlResourceDownloadResult")
+ throw POSTResultNotMatchException()
+ case _ => throw POSTResultNotMatchException()
+ }
+ }
+
//todo 现在是为了通过编译
private def getInputStream(str: String):InputStream = {
null
diff --git a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/conf/BmlConfiguration.scala b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/conf/BmlConfiguration.scala
index 2bb0ce5455..cc2e6d9990 100644
--- a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/conf/BmlConfiguration.scala
+++ b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/conf/BmlConfiguration.scala
@@ -22,11 +22,7 @@ import com.webank.wedatasphere.linkis.common.conf.CommonVars
* Description:
*/
object BmlConfiguration {
- val GATEWAY_IP:CommonVars[String] =
- CommonVars[String]("wds.linkis.gateway.ip", "ip", "DWS gateway的ip地址")
- val GATEWAY_PORT:CommonVars[Int] =
- CommonVars[Int]("wds.linkis.gateway.port", 1000, "DWS gateway的端口")
val DWS_VERSION:CommonVars[String] = CommonVars[String]("wds.linkis.bml.dws.version", "v1")
@@ -47,6 +43,8 @@ object BmlConfiguration {
val DOWNLOAD_URL:CommonVars[String] = CommonVars[String]("wds.linkis.bml.download.url", "download")
+ val DELETE_URL:CommonVars[String] = CommonVars[String]("wds.linkis.bml.delete.url", "delete")
+
val GET_VERSIONS_URL:CommonVars[String] = CommonVars[String]("wds.linkis.bml.getVersions.url", "getVersions")
val GET_BASIC_URL:CommonVars[String] = CommonVars[String]("wds.linkis.bml.getBasic.url","getBasic")
diff --git a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/http/HttpConf.scala b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/http/HttpConf.scala
index 57029704bf..4d335e3e79 100644
--- a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/http/HttpConf.scala
+++ b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/http/HttpConf.scala
@@ -16,22 +16,22 @@
package com.webank.wedatasphere.linkis.bml.http
import com.webank.wedatasphere.linkis.bml.conf.BmlConfiguration
+import com.webank.wedatasphere.linkis.common.conf.Configuration
/**
* created by cooperyang on 2019/5/15
* Description:
*/
object HttpConf {
- val ip:String = BmlConfiguration.GATEWAY_IP.getValue
- val port:Int = BmlConfiguration.GATEWAY_PORT.getValue
- val schema:String = "http://"
- val gatewayInstance:String = schema + ip + ":" + port
- val urlPrefix:String = if (BmlConfiguration.URL_PREFIX.getValue.endsWith("/")) {
+
+ val gatewayInstance: String = Configuration.getGateWayURL()
+ val urlPrefix: String = if (BmlConfiguration.URL_PREFIX.getValue.endsWith("/")) {
BmlConfiguration.URL_PREFIX.getValue.substring(0, BmlConfiguration.URL_PREFIX.getValue.length - 1)
- }else BmlConfiguration.URL_PREFIX.getValue
+ } else BmlConfiguration.URL_PREFIX.getValue
val uploadURL:String = urlPrefix + "/" + BmlConfiguration.UPLOAD_URL.getValue
val downloadURL:String = urlPrefix + "/" + BmlConfiguration.DOWNLOAD_URL.getValue
+ val deleteURL:String = urlPrefix + "/" + BmlConfiguration.DELETE_URL
val updateVersionURL:String = urlPrefix + "/" + BmlConfiguration.UPDATE_VERSION_URL.getValue
val relateHdfsURL:String = gatewayInstance + urlPrefix + "/" + BmlConfiguration.RELATE_HDFS.getValue
val relateStorageURL:String = gatewayInstance + urlPrefix + "/" + BmlConfiguration.RELATE_STORAGE.getValue
diff --git a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/request/BmlPOSTAction.scala b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/request/BmlPOSTAction.scala
index db40ec9f40..be915bea2c 100644
--- a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/request/BmlPOSTAction.scala
+++ b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/request/BmlPOSTAction.scala
@@ -19,11 +19,7 @@ import java.io.{File, InputStream}
import java.util
import com.webank.wedatasphere.linkis.bml.http.HttpConf
-
-import scala.collection.JavaConversions._
-import com.webank.wedatasphere.linkis.common.io.FsPath
import com.webank.wedatasphere.linkis.httpclient.request._
-import com.webank.wedatasphere.linkis.storage.FSFactory
/**
* created by cooperyang on 2019/5/23
@@ -173,5 +169,11 @@ case class BmlGetBasicAction(resourceId:String) extends BmlGETAction with UserAc
+case class BmlDeleteAction(resourceId:String) extends BmlPOSTAction {
+ override def getRequestPayload: String = ""
+
+ override def getURL: String = HttpConf.deleteURL
+}
+
diff --git a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/response/BmlResult.scala b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/response/BmlResult.scala
index b43ca48529..a63943bab0 100644
--- a/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/response/BmlResult.scala
+++ b/bml/bmlclient/src/main/scala/com/webank/wedatasphere/linkis/bml/response/BmlResult.scala
@@ -21,8 +21,6 @@ import com.webank.wedatasphere.linkis.bml.protocol.ResourceVersions
import com.webank.wedatasphere.linkis.httpclient.dws.annotation.DWSHttpMessageResult
import com.webank.wedatasphere.linkis.httpclient.dws.response.DWSResult
-import scala.beans.BeanProperty
-
/**
* created by cooperyang on 2019/5/23
* Description:
@@ -106,3 +104,8 @@ class BmlGetBasicResult extends BmlResult{
def getDownloadedFileName:String = this.downloadedFileName
def setDownloadedFileName(downloadedFileName:String):Unit = this.downloadedFileName = downloadedFileName
}
+
+@DWSHttpMessageResult("/api/rest_j/v\\d+/bml/delete")
+class BmlDeleteResult extends BmlResult{
+
+}
\ No newline at end of file
diff --git a/bml/bmlcommon/src/main/scala/com/webank/wedatasphere/linkis/bml/protocol/BmlProtocol.scala b/bml/bmlcommon/src/main/scala/com/webank/wedatasphere/linkis/bml/protocol/BmlProtocol.scala
index 25465ce39e..c8f29e4086 100644
--- a/bml/bmlcommon/src/main/scala/com/webank/wedatasphere/linkis/bml/protocol/BmlProtocol.scala
+++ b/bml/bmlcommon/src/main/scala/com/webank/wedatasphere/linkis/bml/protocol/BmlProtocol.scala
@@ -74,3 +74,6 @@ case class ResourceVersions(resourceId:String,
case class BmlResourceVersionsResponse(isSuccess:Boolean,
resourceId:String,
resourceVersions: ResourceVersions) extends BmlResponse(isSuccess)
+
+
+case class BmlDeleteResponse(isSuccess:Boolean) extends BmlResponse(isSuccess)
\ No newline at end of file
diff --git a/bml/bmlserver/bin/start-bml.sh b/bml/bmlserver/bin/start-bml.sh
index 56cab6df00..80cc775a4a 100644
--- a/bml/bmlserver/bin/start-bml.sh
+++ b/bml/bmlserver/bin/start-bml.sh
@@ -26,7 +26,7 @@ if [[ -f "${SERVER_PID}" ]]; then
fi
fi
-nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+nohup java $SERVER_JAVA_OPTS -cp ../module/lib/*:$HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "server $SERVER_NAME start failed!"
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/common/HdfsResourceHelper.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/common/HdfsResourceHelper.java
index 1b3a32e145..35072a6f3c 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/common/HdfsResourceHelper.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/common/HdfsResourceHelper.java
@@ -20,7 +20,6 @@
import com.webank.wedatasphere.linkis.common.io.FsPath;
import com.webank.wedatasphere.linkis.storage.FSFactory;
import com.webank.wedatasphere.linkis.storage.utils.FileSystemUtils;
-
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/DownloadDao.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/DownloadDao.java
index d28673e961..eb2c8671f8 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/DownloadDao.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/DownloadDao.java
@@ -25,7 +25,7 @@
*/
public interface DownloadDao {
- void insertDownloadModel(@Param("downloadModel")DownloadModel downloadModel);
+ void insertDownloadModel(@Param("downloadModel") DownloadModel downloadModel);
}
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/VersionDao.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/VersionDao.java
index be5e947b65..2c23ab2a61 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/VersionDao.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/dao/VersionDao.java
@@ -55,7 +55,7 @@ public interface VersionDao {
@Select("select start_byte from linkis_resources_version where resource_id = #{resourceId} and version = #{version}")
- long getStartByteForResource(@Param("resourceId") String resourceId, @Param("version")String version);
+ long getStartByteForResource(@Param("resourceId") String resourceId, @Param("version") String version);
@@ -75,14 +75,14 @@ ResourceVersion findResourceVersion(@Param("resourceId") String resourceId,
@Select("select enable_flag from `linkis_resources_version` where resource_id = #{resourceId} and version = #{version}")
- int selectResourceVersionEnbleFlag(@Param("resourceId") String resourceId, @Param("version")String version);
+ int selectResourceVersionEnbleFlag(@Param("resourceId") String resourceId, @Param("version") String version);
/**
* 将resourceId对应的所有版本的enable_flag设为0,这样就不能继续访问该资源的任意版本
* @param resourceId resourceId
*/
@Update("update `linkis_resources_version` set enable_flag = 0 where resource_id = #{resourceId}")
- void deleteResource(@Param("resourceId")String resourceId);
+ void deleteResource(@Param("resourceId") String resourceId);
void batchDeleteResources(@Param("resourceIds") List resourceIds);
@@ -92,6 +92,6 @@ ResourceVersion findResourceVersion(@Param("resourceId") String resourceId,
- List selectVersionByPage(@Param("resourceId")String resourceId);
+ List selectVersionByPage(@Param("resourceId") String resourceId);
}
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/restful/BmlRestfulApi.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/restful/BmlRestfulApi.java
index 072d377d9c..412bfeb813 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/restful/BmlRestfulApi.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/restful/BmlRestfulApi.java
@@ -15,17 +15,9 @@
*/
package com.webank.wedatasphere.linkis.bml.restful;
-import com.webank.wedatasphere.linkis.bml.Entity.DownloadModel;
-import com.webank.wedatasphere.linkis.bml.Entity.Resource;
-import com.webank.wedatasphere.linkis.bml.Entity.ResourceTask;
-import com.webank.wedatasphere.linkis.bml.Entity.ResourceVersion;
-import com.webank.wedatasphere.linkis.bml.Entity.Version;
-import com.webank.wedatasphere.linkis.bml.common.Constant;
-import com.webank.wedatasphere.linkis.bml.service.BmlService;
-import com.webank.wedatasphere.linkis.bml.service.DownloadService;
-import com.webank.wedatasphere.linkis.bml.service.ResourceService;
-import com.webank.wedatasphere.linkis.bml.service.TaskService;
-import com.webank.wedatasphere.linkis.bml.service.VersionService;
+import com.webank.wedatasphere.linkis.bml.Entity.*;
+import com.webank.wedatasphere.linkis.bml.common.*;
+import com.webank.wedatasphere.linkis.bml.service.*;
import com.webank.wedatasphere.linkis.bml.threading.TaskState;
import com.webank.wedatasphere.linkis.bml.util.HttpRequestHelper;
import com.webank.wedatasphere.linkis.bml.vo.ResourceBasicVO;
@@ -33,8 +25,6 @@
import com.webank.wedatasphere.linkis.bml.vo.ResourceVersionsVO;
import com.webank.wedatasphere.linkis.common.exception.ErrorException;
import com.webank.wedatasphere.linkis.server.Message;
-import com.webank.wedatasphere.linkis.bml.common.*;
-
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.codehaus.jackson.JsonNode;
@@ -45,25 +35,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
+import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.util.*;
/**
* created by cooperyang on 2019/5/14
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/TaskService.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/TaskService.java
index 5aed763d09..cad6695cdc 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/TaskService.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/TaskService.java
@@ -53,7 +53,7 @@ ResourceTask createUpdateTask(String resourceId, String user, FormDataMultiPart
* @param updateTime 操作时间
* @param errMsg 异常信息
*/
- void updateState2Failed( long taskId, String state, Date updateTime, String errMsg);
+ void updateState2Failed(long taskId, String state, Date updateTime, String errMsg);
ResourceTask createDeleteVersionTask(String resourceId, String version, String user, String ip);
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/VersionService.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/VersionService.java
index 7b218709fe..332a8b53ed 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/VersionService.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/VersionService.java
@@ -38,7 +38,7 @@ public interface VersionService {
List getAllResourcesViaSystem(String system, String user);
//分页查询VResourcesViaSystem
- public List selectResourcesViaSystemByPage(int currentPage, int pageSize,String system, String user);
+ public List selectResourcesViaSystemByPage(int currentPage, int pageSize, String system, String user);
void deleteResourceVersion(String resourceId, String version);
@@ -55,7 +55,7 @@ public interface VersionService {
List getVersions(String resourceId);
//分页查询Version
- List selectVersionByPage(int currentPage, int pageSize,String resourceId);
+ List selectVersionByPage(int currentPage, int pageSize, String resourceId);
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/ResourceServiceImpl.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/ResourceServiceImpl.java
index 06379f9196..fe0a4868b0 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/ResourceServiceImpl.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/ResourceServiceImpl.java
@@ -24,7 +24,6 @@
import com.webank.wedatasphere.linkis.bml.dao.VersionDao;
import com.webank.wedatasphere.linkis.bml.service.ResourceService;
import com.webank.wedatasphere.linkis.common.exception.ErrorException;
-
import org.apache.commons.lang.StringUtils;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
@@ -35,13 +34,12 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import javax.validation.constraints.NotNull;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.validation.constraints.NotNull;
-
/**
* Created by cooperyang on 2019/5/17.
*/
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/TaskServiceImpl.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/TaskServiceImpl.java
index cc7a3dc0ef..830b6c084a 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/TaskServiceImpl.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/TaskServiceImpl.java
@@ -18,6 +18,7 @@
import com.webank.wedatasphere.linkis.bml.Entity.ResourceTask;
import com.webank.wedatasphere.linkis.bml.Entity.Version;
import com.webank.wedatasphere.linkis.bml.common.Constant;
+import com.webank.wedatasphere.linkis.bml.common.UpdateResourceException;
import com.webank.wedatasphere.linkis.bml.dao.ResourceDao;
import com.webank.wedatasphere.linkis.bml.dao.TaskDao;
import com.webank.wedatasphere.linkis.bml.dao.VersionDao;
@@ -25,7 +26,6 @@
import com.webank.wedatasphere.linkis.bml.service.TaskService;
import com.webank.wedatasphere.linkis.bml.service.VersionService;
import com.webank.wedatasphere.linkis.bml.threading.TaskState;
-import com.webank.wedatasphere.linkis.bml.common.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
diff --git a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/VersionServiceImpl.java b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/VersionServiceImpl.java
index 9d0142e57b..1003fa1fc1 100644
--- a/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/VersionServiceImpl.java
+++ b/bml/bmlserver/src/main/java/com/webank/wedatasphere/linkis/bml/service/impl/VersionServiceImpl.java
@@ -28,7 +28,6 @@
import com.webank.wedatasphere.linkis.common.io.Fs;
import com.webank.wedatasphere.linkis.common.io.FsPath;
import com.webank.wedatasphere.linkis.storage.FSFactory;
-
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
From e2718dfffd0e361bb358a498e23604f3c5ab4cf0 Mon Sep 17 00:00:00 2001
From: yangzhiyue <904666286@qq.com>
Date: Wed, 3 Jun 2020 22:03:08 +0800
Subject: [PATCH 7/8] update ujes module to adjust context service
---
.../ujes/client/response/JobInfoResult.scala | 10 +-
.../client/response/JobProgressResult.scala | 1 -
.../hive/HiveEngineSpringConfiguration.scala | 2 +-
.../linkis/engine/hive/common/HiveUtils.scala | 3 +-
.../hive/executor/HiveEngineExecutor.scala | 2 +-
.../hive/hook/UseDatabaseEngineHook.scala | 2 -
.../hive/progress/HiveProgressHelper.scala | 1 -
.../hive/process/HiveQLProcessBuilder.scala | 5 +-
.../hive/entrance/bin/start-hive-entrance.sh | 2 +-
.../jdbc/entrance/bin/start-jdbc-entrance.sh | 2 +-
ujes/definedEngines/jdbc/entrance/pom.xml | 4 +-
.../conf/executer/ConnectionManager.java | 4 +-
.../conf/JDBCSpringConfiguration.scala | 1 -
.../engine/pipeline/OutputStreamCache.scala | 2 +-
.../engine/pipeline/PipeEngineJob.scala | 2 +-
.../pipeline/PipelineEngineParser.scala | 2 +-
.../pipeline/constant/PipeLineConstant.scala | 2 +-
.../pipeline/conversions/FsConvertions.scala | 37 ++++
.../pipeline/executor/CSVExecutor.scala | 2 +-
.../pipeline/executor/CopyExecutor.scala | 2 +-
.../pipeline/executor/ExcelExecutor.scala | 2 +-
.../PipeLineDefaultEngineCreator.scala | 1 -
.../PipeLineProcessEngineBuilder.scala | 1 -
.../entrance/bin/start-pipeline-entrance.sh | 2 +-
.../linkis/engine/ExecuteResponse.scala | 1 -
.../engine/HDFSResultSetOutputStream.scala | 1 +
.../PythonEngineSpringConfiguration.scala | 2 +-
.../linkis/engine/PythonSession.scala | 23 ++-
.../executors/PythonEngineExecutor.scala | 6 +-
.../python/enginemanager/pom.xml | 5 +-
.../PythonEngineSpringConfiguration.scala | 2 -
.../entrance/bin/start-python-entrance.sh | 2 +-
.../shell/executor/ShellEngineExecutor.scala | 7 +-
.../executor/ShellEngineExecutorFactory.scala | 2 +-
.../ShellEngineManagerConfiguration.scala | 5 +-
.../entrance/bin/start-shell-entrance.sh | 2 +-
.../Interpreter/ProcessInterpreter.scala | 5 +-
.../Interpreter/PythonInterpreter.scala | 13 +-
.../configuration/SparkConfiguration.scala | 3 +
...SparkEngineServerSpringConfiguration.scala | 73 ++++----
.../linkis/engine/cs/CSSparkHelper.scala | 34 ++++
.../engine/cs/CSSparkPreExecutionHook.scala | 55 ++++++
.../linkis/engine/cs/CSTableParser.scala | 89 ++++++++++
.../engine/execute/SparkEngineJob.scala | 1 +
.../executors/SparkEngineExecutor.scala | 18 +-
.../engine/executors/SparkExecutor.scala | 5 +-
.../executors/SparkPythonExecutor.scala | 11 +-
.../factory/SparkEngineExecutorFactory.scala | 11 +-
.../linkis/engine/imexport/CsvRelation.scala | 2 +-
.../engine/mdq/MDQPostExecutionHook.scala | 3 +-
.../engine/mdq/MDQPreExecutionHook.scala | 2 +-
.../spark/common/LineBufferedStream.scala | 2 +-
.../engine/spark/common/LogContainer.scala | 2 +-
.../engine/spark/utils/EngineUtils.scala | 2 +-
.../datasources/csv/DolphinToSpark.scala | 5 +-
.../configuration/SparkConfiguration.scala | 2 -
...parkEngineManagerSpringConfiguration.scala | 1 -
.../process/SparkEngineCreator.scala | 5 +-
.../process/SparkSubmitProcessBuilder.scala | 7 +-
.../entrance/job/SparkEntranceJob.scala | 1 -
.../TiSparkSpringConfiguration.scala | 5 -
.../tispark/engine/hook/TiSparkHook.scala | 7 -
ujes/engine/pom.xml | 5 +
.../linkis/engine/log/LogCache.java | 2 -
.../linkis/engine/log/MountLogCache.java | 4 +-
.../linkis/engine/log/RPCAppender.java | 8 -
.../linkis/engine/log/SendAppender.java | 68 ++++---
.../linkis/engine/EngineReceiver.scala | 4 +-
.../linkis/engine/EngineServer.scala | 1 -
.../EngineServerSpringConfiguration.scala | 1 -
.../linkis/engine/LockManager.scala | 1 -
.../engine/PropertiesExecuteRequest.scala | 22 +++
.../engine/ResourceExecuteRequest.scala | 2 +-
.../engine/conf/EngineConfiguration.scala | 6 +
.../engine/cs/CSEnginePreExecuteHook.scala | 49 +++++
.../linkis/engine/cs/CSResourceParser.scala | 73 ++++++++
.../linkis/engine/cs/CSTableRegister.scala | 92 ++++++++++
.../linkis/engine/execute/CodeParser.scala | 10 +-
.../engine/execute/EngineExecutor.scala | 20 +--
.../execute/EngineExecutorContext.scala | 59 ++++--
.../execute/EngineExecutorManager.scala | 3 +-
.../linkis/engine/execute/EngineJob.scala | 22 ++-
.../hook/CodeGeneratorEngineHook.scala | 1 -
.../execute/hook/ReleaseEngineHook.scala | 3 +-
.../execute/hook/UdfLoadEngineHook.scala | 4 +-
.../extension/EnginePreExecuteHook.scala | 2 +-
.../engine/lock/EngineTimedLockManager.scala | 4 -
.../linkis/engine/log/LogHelper.scala | 2 +-
.../execute/SparkCombinedCodeParserTest.scala | 5 -
.../lock/EngineTimedLockManagerTest.scala | 1 -
.../linkis/engine/log/ScalaLoggingTest.scala | 1 -
.../enginemanager/AbstractEngineCreator.scala | 2 +-
.../enginemanager/AbstractEngineManager.scala | 6 +-
.../enginemanager/conf/EnvConfiguration.scala | 2 +-
.../exception/EMRetryException.scala | 10 ++
.../hook/JarLoaderEngineHook.scala | 13 +-
.../impl/EngineManagerImpl.scala | 2 +-
.../EngineManagerSpringConfiguration.scala | 1 -
ujes/entrance/pom.xml | 13 ++
...EntranceExecutorManagerBeanAnnotation.java | 5 +-
.../conf/EntranceSpringConfiguration.java | 12 +-
.../EntranceIllegalParamException.java | 2 -
.../entrance/job/EntranceExecutionJob.java | 1 -
.../parser/AbstractEntranceParser.java | 1 +
.../persistence/QueryPersistenceEngine.java | 5 +-
.../persistence/QueryPersistenceManager.java | 30 +++-
.../entrance/restful/EntranceRestfulApi.java | 44 +++--
.../linkis/entrance/EntranceServer.scala | 1 -
.../entrance/EntranceWebSocketService.scala | 30 +++-
.../entrance/conf/EntranceConfiguration.scala | 25 ++-
.../linkis/entrance/cs/CSEntranceHelper.scala | 168 ++++++++++++++++++
.../exception/CacheNotReadyException.scala | 2 +-
.../exception/JobHistoryFailedException.scala | 9 +
.../execute/EntranceExecutorManager.scala | 12 +-
.../linkis/entrance/execute/EntranceJob.scala | 10 ++
.../entrance/execute/EntranceReceiver.scala | 3 +-
.../interceptor/EntranceInterceptor.scala | 2 +-
.../exception/VarSubstitutionException.scala | 2 +-
.../impl/CSEntranceInterceptor.scala | 42 +++++
.../interceptor/impl/CommentInterceptor.scala | 50 ++----
.../impl/CustomVariableUtils.scala | 134 +++++---------
.../entrance/interceptor/impl/Explain.scala | 27 ++-
.../impl/PythonCodeCheckInterceptor.scala | 2 +-
.../impl/SQLLimitEntranceInterceptor.scala | 1 -
.../impl/ScalaCodeInterceptor.scala | 1 -
.../impl/SparkCodeCheckInterceptor.scala | 4 +-
.../linkis/entrance/log/CacheLogWriter.scala | 7 +-
.../entrance/log/ErrorCodeManager.scala | 12 --
.../parser/CommonEntranceParser.scala | 16 +-
.../persistence/EntranceResultSetEngine.scala | 2 -
.../persistence/PersistenceEngine.scala | 1 -
.../restful/EntranceRestfulRemote.scala | 5 +-
.../scheduler/EntranceGroupFactory.scala | 3 +-
.../scheduler/EntranceSchedulerContext.scala | 2 -
.../entrance/utils/JobHistoryHelper.scala | 87 +++++++++
ujes/entranceclient/pom.xml | 6 +
ujes/jdbc/pom.xml | 15 +-
137 files changed, 1334 insertions(+), 487 deletions(-)
create mode 100644 ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/conversions/FsConvertions.scala
create mode 100644 ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkHelper.scala
create mode 100644 ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkPreExecutionHook.scala
create mode 100644 ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableParser.scala
create mode 100644 ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PropertiesExecuteRequest.scala
create mode 100644 ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSEnginePreExecuteHook.scala
create mode 100644 ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSResourceParser.scala
create mode 100644 ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableRegister.scala
create mode 100644 ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/exception/EMRetryException.scala
create mode 100644 ujes/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/cs/CSEntranceHelper.scala
create mode 100644 ujes/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/exception/JobHistoryFailedException.scala
create mode 100644 ujes/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/interceptor/impl/CSEntranceInterceptor.scala
create mode 100644 ujes/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/utils/JobHistoryHelper.scala
diff --git a/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobInfoResult.scala b/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobInfoResult.scala
index 5c721803cf..61c84b19df 100644
--- a/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobInfoResult.scala
+++ b/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobInfoResult.scala
@@ -23,6 +23,7 @@ package com.webank.wedatasphere.linkis.ujes.client.response
import java.util
import java.util.Date
+import com.webank.wedatasphere.linkis.common.utils.Utils
import com.webank.wedatasphere.linkis.httpclient.dws.annotation.DWSHttpMessageResult
import com.webank.wedatasphere.linkis.httpclient.dws.response.DWSResult
import com.webank.wedatasphere.linkis.protocol.query.RequestPersistTask
@@ -48,9 +49,16 @@ class JobInfoResult extends DWSResult with UserAction with Status {
val updatedTime = task.get("updatedTime").asInstanceOf[Long]
task.remove("createdTime")
task.remove("updatedTime")
- BeanUtils.populate(requestPersistTask, task)
+ task.remove("engineStartTime")
+ Utils.tryCatch{
+ BeanUtils.populate(requestPersistTask, task.asInstanceOf[util.Map[String, _]])
+ }{
+ case e:Exception => error("copy failed", e)
+ }
+ requestPersistTask.setStatus(task.get("status").asInstanceOf[String])
requestPersistTask.setCreatedTime(new Date(createdTime))
requestPersistTask.setUpdatedTime(new Date(updatedTime))
+ requestPersistTask.setEngineStartTime(new Date(updatedTime))
}
def getTask = task
diff --git a/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobProgressResult.scala b/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobProgressResult.scala
index 4b9b4d7846..b6988eb729 100644
--- a/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobProgressResult.scala
+++ b/ujes/client/src/main/scala/com/webank/wedatasphere/linkis/ujes/client/response/JobProgressResult.scala
@@ -24,7 +24,6 @@ import java.util.{List, Map}
import com.webank.wedatasphere.linkis.httpclient.dws.annotation.DWSHttpMessageResult
import com.webank.wedatasphere.linkis.protocol.engine.JobProgressInfo
-
import org.json4s._
import org.json4s.jackson.Serialization._
diff --git a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/HiveEngineSpringConfiguration.scala b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/HiveEngineSpringConfiguration.scala
index a7e57f34bf..61455f49a4 100644
--- a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/HiveEngineSpringConfiguration.scala
+++ b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/HiveEngineSpringConfiguration.scala
@@ -18,7 +18,7 @@ package com.webank.wedatasphere.linkis.engine.hive
import com.webank.wedatasphere.linkis.engine.execute.hook._
import com.webank.wedatasphere.linkis.engine.execute.{CodeParser, EngineHook, SQLCodeParser}
-import com.webank.wedatasphere.linkis.engine.hive.hook.{HiveAddJarsEngineHook, UseDatabaseEngineHook}
+import com.webank.wedatasphere.linkis.engine.hive.hook.HiveAddJarsEngineHook
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.{Bean, Configuration}
diff --git a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/common/HiveUtils.scala b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/common/HiveUtils.scala
index b3aba20105..0faf90f831 100644
--- a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/common/HiveUtils.scala
+++ b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/common/HiveUtils.scala
@@ -19,14 +19,13 @@ package com.webank.wedatasphere.linkis.engine.hive.common
import java.io.File
import java.nio.file.Paths
+import com.webank.wedatasphere.linkis.common.conf.{Configuration => CommonConfiguration}
import com.webank.wedatasphere.linkis.engine.hive.exception.HadoopConfSetFailedException
-
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import org.apache.hadoop.hive.conf
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.ql.Driver
-import com.webank.wedatasphere.linkis.common.conf.{Configuration => CommonConfiguration}
/**
* created by cooperyang on 2018/11/22
diff --git a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/executor/HiveEngineExecutor.scala b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/executor/HiveEngineExecutor.scala
index c0ace13d28..b12cc4ffc1 100644
--- a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/executor/HiveEngineExecutor.scala
+++ b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/executor/HiveEngineExecutor.scala
@@ -36,10 +36,10 @@ import org.apache.commons.io.IOUtils
import org.apache.commons.lang.StringUtils
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.metastore.api.{FieldSchema, Schema}
+import org.apache.hadoop.hive.ql.Driver
import org.apache.hadoop.hive.ql.exec.mr.HadoopJobExecHelper
import org.apache.hadoop.hive.ql.processors.{CommandProcessor, CommandProcessorFactory, CommandProcessorResponse}
import org.apache.hadoop.hive.ql.session.SessionState
-import org.apache.hadoop.hive.ql.Driver
import org.apache.hadoop.mapred.RunningJob
import org.apache.hadoop.security.UserGroupInformation
import org.slf4j.LoggerFactory
diff --git a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/hook/UseDatabaseEngineHook.scala b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/hook/UseDatabaseEngineHook.scala
index 5bade51956..728925a805 100644
--- a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/hook/UseDatabaseEngineHook.scala
+++ b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/hook/UseDatabaseEngineHook.scala
@@ -22,8 +22,6 @@ import com.webank.wedatasphere.linkis.server.JMap
import org.apache.commons.lang.StringUtils
import org.slf4j.{Logger, LoggerFactory}
-import scala.collection.mutable.ArrayBuffer
-
/**
* created by cooperyang on 2019/4/22
* Description:
diff --git a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/progress/HiveProgressHelper.scala b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/progress/HiveProgressHelper.scala
index 047f2c069c..cf1188b717 100644
--- a/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/progress/HiveProgressHelper.scala
+++ b/ujes/definedEngines/hive/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/hive/progress/HiveProgressHelper.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.engine.hive.progress
-import java.util
import java.util.concurrent.LinkedBlockingQueue
import com.webank.wedatasphere.linkis.engine.hive.log.HiveProgress
diff --git a/ujes/definedEngines/hive/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hive/process/HiveQLProcessBuilder.scala b/ujes/definedEngines/hive/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hive/process/HiveQLProcessBuilder.scala
index 1a8a358c56..897c9dc753 100644
--- a/ujes/definedEngines/hive/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hive/process/HiveQLProcessBuilder.scala
+++ b/ujes/definedEngines/hive/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hive/process/HiveQLProcessBuilder.scala
@@ -19,15 +19,14 @@ package com.webank.wedatasphere.linkis.enginemanager.hive.process
import java.nio.file.Paths
import com.webank.wedatasphere.linkis.common.conf.Configuration
-import com.webank.wedatasphere.linkis.enginemanager.{AbstractEngineCreator, EngineResource}
-import com.webank.wedatasphere.linkis.enginemanager.conf.EnvConfiguration.{DEFAULT_JAVA_OPTS, ENGINE_CLIENT_MEMORY, JAVA_HOME, engineGCLogPath}
+import com.webank.wedatasphere.linkis.enginemanager.conf.EnvConfiguration.{DEFAULT_JAVA_OPTS, JAVA_HOME, engineGCLogPath}
import com.webank.wedatasphere.linkis.enginemanager.hive.conf.HiveEngineConfiguration
import com.webank.wedatasphere.linkis.enginemanager.impl.UserEngineResource
import com.webank.wedatasphere.linkis.enginemanager.process.JavaProcessEngineBuilder
+import com.webank.wedatasphere.linkis.enginemanager.{AbstractEngineCreator, EngineResource}
import com.webank.wedatasphere.linkis.protocol.engine.RequestEngine
import org.apache.commons.lang.StringUtils
import org.slf4j.LoggerFactory
-import org.springframework.stereotype.Component
import scala.collection.mutable.ArrayBuffer
diff --git a/ujes/definedEngines/hive/entrance/bin/start-hive-entrance.sh b/ujes/definedEngines/hive/entrance/bin/start-hive-entrance.sh
index 56cab6df00..80cc775a4a 100644
--- a/ujes/definedEngines/hive/entrance/bin/start-hive-entrance.sh
+++ b/ujes/definedEngines/hive/entrance/bin/start-hive-entrance.sh
@@ -26,7 +26,7 @@ if [[ -f "${SERVER_PID}" ]]; then
fi
fi
-nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+nohup java $SERVER_JAVA_OPTS -cp ../module/lib/*:$HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "server $SERVER_NAME start failed!"
diff --git a/ujes/definedEngines/jdbc/entrance/bin/start-jdbc-entrance.sh b/ujes/definedEngines/jdbc/entrance/bin/start-jdbc-entrance.sh
index 56cab6df00..80cc775a4a 100644
--- a/ujes/definedEngines/jdbc/entrance/bin/start-jdbc-entrance.sh
+++ b/ujes/definedEngines/jdbc/entrance/bin/start-jdbc-entrance.sh
@@ -26,7 +26,7 @@ if [[ -f "${SERVER_PID}" ]]; then
fi
fi
-nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+nohup java $SERVER_JAVA_OPTS -cp ../module/lib/*:$HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "server $SERVER_NAME start failed!"
diff --git a/ujes/definedEngines/jdbc/entrance/pom.xml b/ujes/definedEngines/jdbc/entrance/pom.xml
index 0f214b667c..bba9386513 100644
--- a/ujes/definedEngines/jdbc/entrance/pom.xml
+++ b/ujes/definedEngines/jdbc/entrance/pom.xml
@@ -77,7 +77,7 @@
org.apache.thrift
libthrift
- 0.9.3
+ 0.9.2
pom
@@ -139,4 +139,4 @@
${project.artifactId}-${project.version}
-
+
\ No newline at end of file
diff --git a/ujes/definedEngines/jdbc/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/executer/ConnectionManager.java b/ujes/definedEngines/jdbc/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/executer/ConnectionManager.java
index 793f4c54d9..c3e3772049 100644
--- a/ujes/definedEngines/jdbc/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/executer/ConnectionManager.java
+++ b/ujes/definedEngines/jdbc/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/executer/ConnectionManager.java
@@ -18,6 +18,8 @@
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.dbcp.BasicDataSourceFactory;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.sql.DataSource;
import java.sql.Connection;
@@ -27,8 +29,6 @@
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class ConnectionManager {
diff --git a/ujes/definedEngines/jdbc/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/conf/JDBCSpringConfiguration.scala b/ujes/definedEngines/jdbc/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/conf/JDBCSpringConfiguration.scala
index c42ba79486..50ccfe781a 100644
--- a/ujes/definedEngines/jdbc/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/conf/JDBCSpringConfiguration.scala
+++ b/ujes/definedEngines/jdbc/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/conf/JDBCSpringConfiguration.scala
@@ -23,7 +23,6 @@ import com.webank.wedatasphere.linkis.entrance.parser.JDBCEntranceParser
import com.webank.wedatasphere.linkis.scheduler.queue.GroupFactory
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Configuration
@Configuration
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/OutputStreamCache.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/OutputStreamCache.scala
index 70c4a7a633..c07a472885 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/OutputStreamCache.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/OutputStreamCache.scala
@@ -18,7 +18,7 @@ package com.webank.wedatasphere.linkis.engine.pipeline
import java.io.OutputStream
/**
- * created by patinousward on 2019/12/9
+ * created by cooperyang on 2019/12/9
* Description:
*/
object OutputStreamCache {
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipeEngineJob.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipeEngineJob.scala
index ce9bdf1a08..76d51cddf8 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipeEngineJob.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipeEngineJob.scala
@@ -18,7 +18,7 @@ package com.webank.wedatasphere.linkis.engine.pipeline
import com.webank.wedatasphere.linkis.engine.execute.CommonEngineJob
/**
- * created by patinousward on 2019/12/9
+ * created by cooperyang on 2019/12/9
* Description:
*/
class PipeEngineJob extends CommonEngineJob {
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipelineEngineParser.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipelineEngineParser.scala
index 1d6cf258a1..fb6db27c41 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipelineEngineParser.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/PipelineEngineParser.scala
@@ -21,7 +21,7 @@ import com.webank.wedatasphere.linkis.scheduler.queue.Job
import org.springframework.stereotype.Component
/**
- * created by patinousward on 2019/12/9
+ * created by cooperyang on 2019/12/9
* Description:
*/
@Component("engineParser")
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/constant/PipeLineConstant.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/constant/PipeLineConstant.scala
index f06bfe935d..80cd7036a4 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/constant/PipeLineConstant.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/constant/PipeLineConstant.scala
@@ -17,7 +17,7 @@
package com.webank.wedatasphere.linkis.engine.pipeline.constant
/**
- * Created by patinousward on 2018/11/16.
+ * Created by johnnwang on 2018/11/16.
*/
object PipeLineConstant {
val DEFAULTC_HARSET = "utf-8"
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/conversions/FsConvertions.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/conversions/FsConvertions.scala
new file mode 100644
index 0000000000..9858a60252
--- /dev/null
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/conversions/FsConvertions.scala
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2019 WeBank
+ *
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.pipeline.conversions
+
+import java.io.Closeable
+
+import com.webank.wedatasphere.linkis.common.io.Fs
+
+/**
+ * Created by johnnwang on 2020/2/4.
+ */
+object FsConvertions {
+
+ implicit def fsToFsClosable(fs: Fs): Closeable = {
+ new FsClosable(fs)
+ }
+}
+
+class FsClosable(fs: Fs) extends Closeable {
+ override def close(): Unit = {
+ fs.close()
+ }
+}
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CSVExecutor.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CSVExecutor.scala
index 4f9c594005..18aaad5684 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CSVExecutor.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CSVExecutor.scala
@@ -22,7 +22,7 @@ import com.webank.wedatasphere.linkis.common.io.FsPath
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
import com.webank.wedatasphere.linkis.engine.pipeline.OutputStreamCache
import com.webank.wedatasphere.linkis.engine.pipeline.constant.PipeLineConstant._
-import com.webank.wedatasphere.linkis.engine.pipeline.conversions.FsConversions._
+import com.webank.wedatasphere.linkis.engine.pipeline.conversions.FsConvertions._
import com.webank.wedatasphere.linkis.engine.pipeline.exception.PipeLineErrorException
import com.webank.wedatasphere.linkis.scheduler.executer.ExecuteResponse
import com.webank.wedatasphere.linkis.server._
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CopyExecutor.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CopyExecutor.scala
index c6e321af56..1a5afdbc1a 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CopyExecutor.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/CopyExecutor.scala
@@ -20,7 +20,7 @@ import com.webank.wedatasphere.linkis.common.io.FsPath
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
import com.webank.wedatasphere.linkis.engine.pipeline.OutputStreamCache
import com.webank.wedatasphere.linkis.engine.pipeline.constant.PipeLineConstant._
-import com.webank.wedatasphere.linkis.engine.pipeline.conversions.FsConversions._
+import com.webank.wedatasphere.linkis.engine.pipeline.conversions.FsConvertions._
import com.webank.wedatasphere.linkis.scheduler.executer.ExecuteResponse
import com.webank.wedatasphere.linkis.server._
import com.webank.wedatasphere.linkis.storage.FSFactory
diff --git a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/ExcelExecutor.scala b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/ExcelExecutor.scala
index 5adaca3114..dde2f103e9 100644
--- a/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/ExcelExecutor.scala
+++ b/ujes/definedEngines/pipeline/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/pipeline/executor/ExcelExecutor.scala
@@ -22,7 +22,7 @@ import com.webank.wedatasphere.linkis.common.io.FsPath
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
import com.webank.wedatasphere.linkis.engine.pipeline.OutputStreamCache
import com.webank.wedatasphere.linkis.engine.pipeline.constant.PipeLineConstant._
-import com.webank.wedatasphere.linkis.engine.pipeline.conversions.FsConversions._
+import com.webank.wedatasphere.linkis.engine.pipeline.conversions.FsConvertions._
import com.webank.wedatasphere.linkis.engine.pipeline.exception.PipeLineErrorException
import com.webank.wedatasphere.linkis.scheduler.executer.ExecuteResponse
import com.webank.wedatasphere.linkis.storage.FSFactory
diff --git a/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineDefaultEngineCreator.scala b/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineDefaultEngineCreator.scala
index cb510de065..cce8def86b 100644
--- a/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineDefaultEngineCreator.scala
+++ b/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineDefaultEngineCreator.scala
@@ -18,7 +18,6 @@ package com.webank.wedatasphere.linkis.enginemanager.pipeline
import com.webank.wedatasphere.linkis.enginemanager.AbstractEngineCreator
import com.webank.wedatasphere.linkis.enginemanager.process.ProcessEngineBuilder
-import org.springframework.stereotype.Component
/**
* Created by johnnwang on 2018/11/15.
diff --git a/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineProcessEngineBuilder.scala b/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineProcessEngineBuilder.scala
index dea14b136a..8381456d79 100644
--- a/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineProcessEngineBuilder.scala
+++ b/ujes/definedEngines/pipeline/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/pipeline/PipeLineProcessEngineBuilder.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.enginemanager.pipeline
-import com.webank.wedatasphere.linkis.common.utils.ClassUtils
import com.webank.wedatasphere.linkis.enginemanager.conf.EngineManagerConfiguration
import com.webank.wedatasphere.linkis.enginemanager.pipeline.conf.PipeLineConfiguration
import com.webank.wedatasphere.linkis.enginemanager.process.JavaProcessEngineBuilder
diff --git a/ujes/definedEngines/pipeline/entrance/bin/start-pipeline-entrance.sh b/ujes/definedEngines/pipeline/entrance/bin/start-pipeline-entrance.sh
index 56cab6df00..80cc775a4a 100644
--- a/ujes/definedEngines/pipeline/entrance/bin/start-pipeline-entrance.sh
+++ b/ujes/definedEngines/pipeline/entrance/bin/start-pipeline-entrance.sh
@@ -26,7 +26,7 @@ if [[ -f "${SERVER_PID}" ]]; then
fi
fi
-nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+nohup java $SERVER_JAVA_OPTS -cp ../module/lib/*:$HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "server $SERVER_NAME start failed!"
diff --git a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ExecuteResponse.scala b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ExecuteResponse.scala
index 4bb9bce44e..8768216985 100644
--- a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ExecuteResponse.scala
+++ b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ExecuteResponse.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.engine
-
import com.webank.wedatasphere.linkis.engine.exception.QueryFailedException
import org.json4s.JValue
import org.json4s.JsonAST.JString
diff --git a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/HDFSResultSetOutputStream.scala b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/HDFSResultSetOutputStream.scala
index ed8b1798cf..7712d3e18b 100644
--- a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/HDFSResultSetOutputStream.scala
+++ b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/HDFSResultSetOutputStream.scala
@@ -15,6 +15,7 @@
*/
package com.webank.wedatasphere.linkis.engine
+
/**
* Created by allenlliu on 2019/4/8.
*/
diff --git a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonEngineSpringConfiguration.scala b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonEngineSpringConfiguration.scala
index 9b919b0f3f..49942708db 100644
--- a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonEngineSpringConfiguration.scala
+++ b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonEngineSpringConfiguration.scala
@@ -16,8 +16,8 @@
package com.webank.wedatasphere.linkis.engine
-import com.webank.wedatasphere.linkis.engine.execute.{CodeParser, EngineHook, PythonCodeParser, SQLCodeParser}
import com.webank.wedatasphere.linkis.engine.execute.hook.{MaxExecuteNumEngineHook, ReleaseEngineHook}
+import com.webank.wedatasphere.linkis.engine.execute.{CodeParser, EngineHook, PythonCodeParser}
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Bean
import org.springframework.stereotype.Component
diff --git a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonSession.scala b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonSession.scala
index 86c7763d7d..af707d6f0a 100644
--- a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonSession.scala
+++ b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PythonSession.scala
@@ -23,30 +23,27 @@ package com.webank.wedatasphere.linkis.engine
import java.io.{File, FileFilter, FileOutputStream, InputStream}
import java.net.ServerSocket
import java.nio.file.Files
-
-import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
-import com.webank.wedatasphere.linkis.engine.exception.{ExecuteException, PythonExecuteError, QueryFailedException}
-import com.webank.wedatasphere.linkis.engine.util.PythonConfiguration._
-import com.webank.wedatasphere.linkis.engine.util._
-import org.apache.commons.exec.CommandLine
-import org.apache.commons.lang.StringUtils
-import py4j.GatewayServer
import java.util.{List => JList}
+import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
import com.webank.wedatasphere.linkis.engine.conf.PythonEngineConfiguration
-
-import scala.collection.JavaConverters._
+import com.webank.wedatasphere.linkis.engine.exception.{ExecuteException, PythonExecuteError}
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
import com.webank.wedatasphere.linkis.engine.rs.RsOutputStream
-import com.webank.wedatasphere.linkis.storage.{LineMetaData, LineRecord}
+import com.webank.wedatasphere.linkis.engine.util.PythonConfiguration._
+import com.webank.wedatasphere.linkis.engine.util._
import com.webank.wedatasphere.linkis.storage.domain._
-import com.webank.wedatasphere.linkis.storage.resultset.{ResultSetFactory, ResultSetWriter}
import com.webank.wedatasphere.linkis.storage.resultset.table.{TableMetaData, TableRecord}
+import com.webank.wedatasphere.linkis.storage.resultset.{ResultSetFactory, ResultSetWriter}
+import com.webank.wedatasphere.linkis.storage.{LineMetaData, LineRecord}
+import org.apache.commons.exec.CommandLine
import org.apache.commons.io.IOUtils
+import org.apache.commons.lang.StringUtils
import org.scalactic.Pass
+import py4j.GatewayServer
import scala.collection.JavaConversions._
-import scala.collection.JavaConverters
+import scala.collection.JavaConverters._
import scala.collection.mutable.{ArrayBuffer, StringBuilder}
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future, Promise}
diff --git a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/PythonEngineExecutor.scala b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/PythonEngineExecutor.scala
index ead201416a..895d20f9de 100644
--- a/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/PythonEngineExecutor.scala
+++ b/ujes/definedEngines/python/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/PythonEngineExecutor.scala
@@ -16,15 +16,13 @@
package com.webank.wedatasphere.linkis.engine.executors
-import java.util.UUID
-
-import com.webank.wedatasphere.linkis.common.utils.{ByteTimeUtils, Logging}
+import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.PythonSession
import com.webank.wedatasphere.linkis.engine.exception.EngineException
import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineExecutorContext}
import com.webank.wedatasphere.linkis.engine.rs.RsOutputStream
import com.webank.wedatasphere.linkis.protocol.engine.JobProgressInfo
-import com.webank.wedatasphere.linkis.resourcemanager.{LoadInstanceResource, LoadResource, Resource}
+import com.webank.wedatasphere.linkis.resourcemanager.{LoadInstanceResource, Resource}
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.executer._
import org.apache.commons.io.IOUtils
diff --git a/ujes/definedEngines/python/enginemanager/pom.xml b/ujes/definedEngines/python/enginemanager/pom.xml
index b81d0f3cad..cac5209654 100644
--- a/ujes/definedEngines/python/enginemanager/pom.xml
+++ b/ujes/definedEngines/python/enginemanager/pom.xml
@@ -32,6 +32,9 @@
+
+ 0.9.4
+
@@ -125,4 +128,4 @@
-
+
\ No newline at end of file
diff --git a/ujes/definedEngines/python/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/PythonEngineSpringConfiguration.scala b/ujes/definedEngines/python/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/PythonEngineSpringConfiguration.scala
index a8904db157..ea57d29321 100644
--- a/ujes/definedEngines/python/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/PythonEngineSpringConfiguration.scala
+++ b/ujes/definedEngines/python/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/PythonEngineSpringConfiguration.scala
@@ -16,9 +16,7 @@
package com.webank.wedatasphere.linkis.enginemanager.process
-import com.webank.wedatasphere.linkis.enginemanager.EngineHook
import com.webank.wedatasphere.linkis.enginemanager.conf.EnvConfiguration
-import com.webank.wedatasphere.linkis.enginemanager.hook.{ConsoleConfigurationEngineHook, JarUdfEngineHook, PyFunctionEngineHook, PyUdfEngineHook}
import com.webank.wedatasphere.linkis.resourcemanager.domain.ModuleInfo
import com.webank.wedatasphere.linkis.resourcemanager.{LoadInstanceResource, ResourceRequestPolicy}
import com.webank.wedatasphere.linkis.rpc.Sender
diff --git a/ujes/definedEngines/python/entrance/bin/start-python-entrance.sh b/ujes/definedEngines/python/entrance/bin/start-python-entrance.sh
index 56cab6df00..80cc775a4a 100644
--- a/ujes/definedEngines/python/entrance/bin/start-python-entrance.sh
+++ b/ujes/definedEngines/python/entrance/bin/start-python-entrance.sh
@@ -26,7 +26,7 @@ if [[ -f "${SERVER_PID}" ]]; then
fi
fi
-nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+nohup java $SERVER_JAVA_OPTS -cp ../module/lib/*:$HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "server $SERVER_NAME start failed!"
diff --git a/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutor.scala b/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutor.scala
index 3847a908bb..322c81bd35 100644
--- a/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutor.scala
+++ b/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutor.scala
@@ -3,15 +3,14 @@ package com.webank.wedatasphere.linkis.engine.shell.executor
import java.io.{BufferedReader, InputStreamReader}
import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineExecutorContext}
+import com.webank.wedatasphere.linkis.engine.shell.conf.ShellEngineConfiguration
+import com.webank.wedatasphere.linkis.engine.shell.exception.ShellCodeErrorException
import com.webank.wedatasphere.linkis.protocol.engine.JobProgressInfo
import com.webank.wedatasphere.linkis.resourcemanager.{LoadInstanceResource, Resource}
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.executer._
-import com.webank.wedatasphere.linkis.engine.shell.conf.ShellEngineConfiguration
-import com.webank.wedatasphere.linkis.engine.shell.exception.ShellCodeErrorException
-import org.apache.commons.lang.StringUtils
-import com.webank.wedatasphere.linkis.engine.execute.EngineExecutor
import org.apache.commons.io.IOUtils
+import org.apache.commons.lang.StringUtils
/**
* created by cooperyang on 2019/5/14
diff --git a/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutorFactory.scala b/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutorFactory.scala
index ef929032cc..81dd094f6d 100644
--- a/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutorFactory.scala
+++ b/ujes/definedEngines/shell/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/shell/executor/ShellEngineExecutorFactory.scala
@@ -2,8 +2,8 @@ package com.webank.wedatasphere.linkis.engine.shell.executor
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineExecutorFactory}
-import com.webank.wedatasphere.linkis.server.JMap
import com.webank.wedatasphere.linkis.engine.shell.exception.NoCorrectUserException
+import com.webank.wedatasphere.linkis.server.JMap
import org.apache.commons.lang.StringUtils
import org.springframework.stereotype.Component
diff --git a/ujes/definedEngines/shell/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/shell/enginemanager/conf/ShellEngineManagerConfiguration.scala b/ujes/definedEngines/shell/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/shell/enginemanager/conf/ShellEngineManagerConfiguration.scala
index 4f95bb7c8c..de397dd291 100644
--- a/ujes/definedEngines/shell/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/shell/enginemanager/conf/ShellEngineManagerConfiguration.scala
+++ b/ujes/definedEngines/shell/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/shell/enginemanager/conf/ShellEngineManagerConfiguration.scala
@@ -3,11 +3,10 @@ package com.webank.wedatasphere.linkis.shell.enginemanager.conf
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.enginemanager.EngineHook
import com.webank.wedatasphere.linkis.enginemanager.conf.EnvConfiguration
-import com.webank.wedatasphere.linkis.enginemanager.hook.{ConsoleConfigurationEngineHook, JarLoaderEngineHook}
-import com.webank.wedatasphere.linkis.resourcemanager.{LoadInstanceResource, ResourceRequestPolicy}
+import com.webank.wedatasphere.linkis.enginemanager.hook.ConsoleConfigurationEngineHook
import com.webank.wedatasphere.linkis.resourcemanager.domain.ModuleInfo
+import com.webank.wedatasphere.linkis.resourcemanager.{LoadInstanceResource, ResourceRequestPolicy}
import com.webank.wedatasphere.linkis.rpc.Sender
-import org.slf4j.{Logger, LoggerFactory}
import org.springframework.context.annotation.{Bean, Configuration}
/**
diff --git a/ujes/definedEngines/shell/entrance/bin/start-shell-entrance.sh b/ujes/definedEngines/shell/entrance/bin/start-shell-entrance.sh
index 56cab6df00..80cc775a4a 100644
--- a/ujes/definedEngines/shell/entrance/bin/start-shell-entrance.sh
+++ b/ujes/definedEngines/shell/entrance/bin/start-shell-entrance.sh
@@ -26,7 +26,7 @@ if [[ -f "${SERVER_PID}" ]]; then
fi
fi
-nohup java $SERVER_JAVA_OPTS -cp $HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
+nohup java $SERVER_JAVA_OPTS -cp ../module/lib/*:$HOME/conf:$HOME/lib/* $SERVER_CLASS 2>&1 > $SERVER_LOG_PATH/linkis.out &
pid=$!
if [[ -z "${pid}" ]]; then
echo "server $SERVER_NAME start failed!"
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/ProcessInterpreter.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/ProcessInterpreter.scala
index fc8e763a3d..e015878772 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/ProcessInterpreter.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/ProcessInterpreter.scala
@@ -20,14 +20,13 @@ import java.io.{BufferedReader, InputStreamReader, PrintWriter}
import java.util.concurrent.TimeUnit
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
-import com.webank.wedatasphere.linkis.engine.spark.common.{LineBufferedStream, Starting, State}
+import com.webank.wedatasphere.linkis.engine.spark.common.{LineBufferedStream, Starting, State, _}
import com.webank.wedatasphere.linkis.scheduler.executer.{ErrorExecuteResponse, ExecuteResponse, SuccessExecuteResponse}
import org.apache.commons.io.IOUtils
import org.json4s._
-import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.duration.Duration
-import com.webank.wedatasphere.linkis.engine.spark.common._
+import scala.concurrent.{Await, ExecutionContext, Future}
/**
* Created by allenlliu on 2018/11/19.
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/PythonInterpreter.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/PythonInterpreter.scala
index 17bf4907ee..638a89abb4 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/PythonInterpreter.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/Interpreter/PythonInterpreter.scala
@@ -15,24 +15,25 @@
*/
package com.webank.wedatasphere.linkis.engine.Interpreter
-import org.apache.spark.{SparkContext, SparkException}
-import org.json4s.jackson.JsonMethods._
-import org.json4s.jackson.Serialization.write
-import org.json4s.{DefaultFormats, JValue}
-import py4j.GatewayServer
+
import java.io._
import java.nio.file.Files
import com.webank.wedatasphere.linkis.common.conf.CommonVars
import com.webank.wedatasphere.linkis.common.io.FsPath
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
-import com.webank.wedatasphere.linkis.engine.configuration.{SparkConfiguration}
+import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
import com.webank.wedatasphere.linkis.engine.spark.common.LineBufferedStream
import com.webank.wedatasphere.linkis.engine.spark.utils.EngineUtils
import com.webank.wedatasphere.linkis.storage.FSFactory
import org.apache.commons.io.IOUtils
import org.apache.spark.sql._
import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.{SparkContext, SparkException}
+import org.json4s.jackson.JsonMethods._
+import org.json4s.jackson.Serialization.write
+import org.json4s.{DefaultFormats, JValue}
+import py4j.GatewayServer
import scala.collection.JavaConversions._
import scala.collection.mutable.ArrayBuffer
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkConfiguration.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkConfiguration.scala
index c6d4936f4d..7326e9998e 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkConfiguration.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkConfiguration.scala
@@ -37,4 +37,7 @@ object SparkConfiguration {
val DOLPHIN_LIMIT_LEN = CommonVars("wds.linkis.dolphin.limit.len",5000)
val MDQ_APPLICATION_NAME = CommonVars("wds.linkis.mdq.application.name", "cloud-datasource")
val SHOW_DF_MAX_RES = CommonVars("wds.linkis.show.df.max.res",Int.MaxValue)
+
+
+ val SPARK_PRE_EXECUTION_HOOKS = CommonVars("wds.linkis.spark.pre.execution.hooks", "com.webank.wedatasphere.linkis.engine.cs.CSSparkPreExecutionHook")
}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkEngineServerSpringConfiguration.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkEngineServerSpringConfiguration.scala
index 06786dd708..92ed884846 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkEngineServerSpringConfiguration.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/configuration/SparkEngineServerSpringConfiguration.scala
@@ -1,37 +1,36 @@
-/*
- * Copyright 2019 WeBank
- *
- * Licensed 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 com.webank.wedatasphere.linkis.engine.configuration
-
-import com.webank.wedatasphere.linkis.engine.condition.EngineHooksCondition
-import com.webank.wedatasphere.linkis.engine.execute.hook._
-import com.webank.wedatasphere.linkis.engine.execute.{CodeParser, EngineHook, SparkCombinedCodeParser}
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
-import org.springframework.context.annotation.{Bean, Conditional, Configuration}
-
-/**
- * Created by allenlliu on 2018/12/3.
- */
-@Configuration
-class SparkEngineServerSpringConfiguration {
- @Bean(Array("codeParser"))
- def createCodeParser(): CodeParser = new SparkCombinedCodeParser()
-
-
- @Bean(Array("engineHooks"))
- @Conditional(Array(classOf[EngineHooksCondition]))
- def createEngineHooks(): Array[EngineHook] = Array(new ReleaseEngineHook, new MaxExecuteNumEngineHook, new JarUdfEngineHook, new PyUdfEngineHook, new ScalaUdfEngineHook, new PyFunctionEngineHook, new ScalaFunctionEngineHook)
-}
+/*
+ * Copyright 2019 WeBank
+ *
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.configuration
+
+import com.webank.wedatasphere.linkis.engine.condition.EngineHooksCondition
+import com.webank.wedatasphere.linkis.engine.execute.hook._
+import com.webank.wedatasphere.linkis.engine.execute.{CodeParser, EngineHook, SparkCombinedCodeParser}
+import org.springframework.context.annotation.{Bean, Conditional, Configuration}
+
+/**
+ * Created by allenlliu on 2018/12/3.
+ */
+@Configuration
+class SparkEngineServerSpringConfiguration {
+ @Bean(Array("codeParser"))
+ def createCodeParser(): CodeParser = new SparkCombinedCodeParser()
+
+
+ @Bean(Array("engineHooks"))
+ @Conditional(Array(classOf[EngineHooksCondition]))
+ def createEngineHooks(): Array[EngineHook] = Array(new ReleaseEngineHook, new MaxExecuteNumEngineHook, new JarUdfEngineHook, new PyUdfEngineHook, new ScalaUdfEngineHook, new PyFunctionEngineHook, new ScalaFunctionEngineHook)
+}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkHelper.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkHelper.scala
new file mode 100644
index 0000000000..287e1c9c80
--- /dev/null
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkHelper.scala
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.cs
+
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextServiceUtils
+import com.webank.wedatasphere.linkis.cs.common.utils.CSCommonUtils
+import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
+import org.apache.spark.SparkContext
+
+/**
+ * @author peacewong
+ * @date 2020/4/19 16:39
+ */
+object CSSparkHelper {
+
+ def setContextIDInfoToSparkConf(engineExecutorContext: EngineExecutorContext, sparkContext: SparkContext): Unit = {
+ val contextIDValueStr = ContextServiceUtils.getContextIDStrByMap(engineExecutorContext.getProperties)
+ val nodeNameStr = ContextServiceUtils.getNodeNameStrByMap(engineExecutorContext.getProperties)
+ sparkContext.setLocalProperty(CSCommonUtils.CONTEXT_ID_STR, contextIDValueStr)
+ sparkContext.setLocalProperty(CSCommonUtils.NODE_NAME_STR, nodeNameStr)
+ }
+
+}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkPreExecutionHook.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkPreExecutionHook.scala
new file mode 100644
index 0000000000..b57584359f
--- /dev/null
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSSparkPreExecutionHook.scala
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.cs
+
+import com.webank.wedatasphere.linkis.common.utils.Logging
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextServiceUtils
+import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
+import com.webank.wedatasphere.linkis.engine.extension.SparkPreExecutionHook
+import javax.annotation.PostConstruct
+import org.springframework.stereotype.Component
+
+/**
+ * @author peacewong
+ * @date 2020/3/6 0:06
+ */
+@Component
+class CSSparkPreExecutionHook extends SparkPreExecutionHook with Logging{
+
+ @PostConstruct
+ def init(): Unit ={
+ SparkPreExecutionHook.register(this)
+ }
+
+ private val csTableParser = new CSTableParser
+
+ override def hookName: String = "CSSparkPreExecutionHook"
+
+ override def callPreExecutionHook(engineExecutorContext: EngineExecutorContext, code: String): String = {
+
+ var parsedCode = code
+ val contextIDValueStr = ContextServiceUtils.getContextIDStrByMap(engineExecutorContext.getProperties)
+ val nodeNameStr = ContextServiceUtils.getNodeNameStrByMap(engineExecutorContext.getProperties)
+ info(s"Start to call CSSparkPreExecutionHook,contextID is $contextIDValueStr, nodeNameStr is $nodeNameStr")
+ parsedCode = try {
+ csTableParser.parse(engineExecutorContext, parsedCode, contextIDValueStr, nodeNameStr)
+ } catch {
+ case t: Throwable =>
+ info("Failed to parser cs table", t)
+ parsedCode
+ }
+ info(s"Finished to call CSSparkPreExecutionHook,contextID is $contextIDValueStr, nodeNameStr is $nodeNameStr")
+ parsedCode
+ }
+}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableParser.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableParser.scala
new file mode 100644
index 0000000000..00580ef98f
--- /dev/null
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableParser.scala
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.cs
+
+import java.util.regex.Pattern
+
+import com.webank.wedatasphere.linkis.common.utils.Logging
+import com.webank.wedatasphere.linkis.cs.client.service.CSTableService
+import com.webank.wedatasphere.linkis.cs.common.entity.metadata.CSTable
+import com.webank.wedatasphere.linkis.cs.common.utils.CSCommonUtils
+import com.webank.wedatasphere.linkis.engine.exception.ExecuteError
+import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
+import org.apache.commons.lang.StringUtils
+import org.apache.spark.sql.SparkSession
+import org.apache.spark.sql.execution.datasources.csv.DolphinToSpark
+
+import scala.collection.mutable.ArrayBuffer
+
+/**
+ * @author peacewong
+ * @date 2020/3/6 9:57
+ */
+class CSTableParser extends Logging {
+
+ private val pb: Pattern = Pattern.compile(CSCommonUtils.CS_TMP_TABLE_PREFIX + "[^\\s\";'()]+[$\\s]{0,1}", Pattern.CASE_INSENSITIVE)
+
+ private val DB = "default."
+
+
+ private def getCSTempTable(code: String): Array[String] = {
+ val bmlResourceNames = new ArrayBuffer[String]()
+ val mb = pb.matcher(code)
+ while (mb.find) bmlResourceNames.append(mb.group.trim)
+ bmlResourceNames.toArray
+ }
+
+ /**
+ * 1. code parse cs_tamp
+ * 2. getCSTable
+ * 3. registerTable:暂时用dopphin,后续修改为拼接sql语句
+ *
+ * @param engineExecutorContext
+ * @param code
+ * @param contextIDValueStr
+ * @param nodeNameStr
+ * @return
+ */
+ def parse(engineExecutorContext: EngineExecutorContext, code: String, contextIDValueStr: String, nodeNameStr: String): String = {
+ val csTempTables = getCSTempTable(code)
+ val parsedTables = new ArrayBuffer[String]()
+ csTempTables.foreach{ csTempTable =>
+ val table = getCSTable(csTempTable, contextIDValueStr, nodeNameStr)
+ if (null == table){
+ throw new ExecuteError(40007,s"The csTable that name is $csTempTable not found in cs")
+ }
+ registerTempTable(table)
+ parsedTables.append(csTempTable)
+ }
+ StringUtils.replaceEach(code, csTempTables,parsedTables.toArray)
+ }
+
+ /**
+ * TODO peaceWong From cs to get csTable
+ * Exact Match
+ * @param csTempTable
+ * @return
+ */
+ def getCSTable(csTempTable:String, contextIDValueStr: String, nodeNameStr: String):CSTable = {
+ CSTableService.getInstance().getUpstreamSuitableTable(contextIDValueStr, nodeNameStr, csTempTable)
+ }
+
+ def registerTempTable(csTable: CSTable):Unit = {
+ val spark = SparkSession.builder().enableHiveSupport().getOrCreate()
+ info(s"Start to create tempView to sparkSession viewName(${csTable.getName}) location(${csTable.getLocation})")
+ DolphinToSpark.createTempView(spark, csTable.getName, csTable.getLocation, true)
+ info(s"Finished to create tempView to sparkSession viewName(${csTable.getName}) location(${csTable.getLocation})")
+ }
+}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/SparkEngineJob.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/SparkEngineJob.scala
index 37c69d0202..60c4f6f236 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/SparkEngineJob.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/SparkEngineJob.scala
@@ -15,6 +15,7 @@
*/
package com.webank.wedatasphere.linkis.engine.execute
+
import com.webank.wedatasphere.linkis.protocol.engine.RequestTask
import com.webank.wedatasphere.linkis.scheduler.executer.{ExecuteRequest, JobExecuteRequest, RunTypeExecuteRequest}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkEngineExecutor.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkEngineExecutor.scala
index afe3dfd5dc..a1c11ccfb5 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkEngineExecutor.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkEngineExecutor.scala
@@ -22,8 +22,9 @@ import java.util.concurrent.atomic.AtomicLong
import com.webank.wedatasphere.linkis.common.utils.{ByteTimeUtils, Logging, Utils}
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
+import com.webank.wedatasphere.linkis.engine.cs.CSSparkHelper
import com.webank.wedatasphere.linkis.engine.exception.{NoSupportEngineException, SparkEngineException}
-import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineExecutorContext}
+import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineExecutorContext, SparkCombinedCodeParser}
import com.webank.wedatasphere.linkis.engine.extension.{SparkPostExecutionHook, SparkPreExecutionHook}
import com.webank.wedatasphere.linkis.engine.spark.common._
import com.webank.wedatasphere.linkis.engine.spark.utils.{EngineUtils, JobProgressUtil}
@@ -64,6 +65,7 @@ class SparkEngineExecutor(val sc: SparkContext, id: Long, outputPrintLimit: Int,
}
}
}, 1000, 3000, TimeUnit.MILLISECONDS)
+ setCodeParser(new SparkCombinedCodeParser)
super.init()
}
@@ -225,15 +227,26 @@ object SQLSession extends Logging {
// get field names
//logger.info("SCHEMA BEGIN")
import java.util
+
+ import scala.collection.JavaConversions._
val colSet = new util.HashSet[String]()
val schema = dataFrame.schema
var columnsSet:StructType = null
schema foreach (s => colSet.add(s.name))
if (colSet.size() < schema.size){
val arr:ArrayBuffer[StructField] = new ArrayBuffer[StructField]()
+ val tmpSet = new util.HashSet[StructField]()
dataFrame.queryExecution.analyzed.output foreach {
attri => val tempAttri = StructField(attri.qualifiedName, attri.dataType, attri.nullable, attri.metadata)
- arr += tempAttri
+ tmpSet += tempAttri
+ }
+ if (tmpSet.size() < schema.size){
+ dataFrame.queryExecution.analyzed.output foreach {
+ attri => val tempAttri = StructField(attri.toString(), attri.dataType, attri.nullable, attri.metadata)
+ arr += tempAttri
+ }
+ }else{
+ tmpSet.foreach(arr += _)
}
columnsSet = StructType(arr.toArray)
}else{
@@ -242,6 +255,7 @@ object SQLSession extends Logging {
//val columnsSet = dataFrame.schema
val columns = columnsSet.map(c =>
Column(c.name, DataType.toDataType(c.dataType.typeName.toLowerCase), c.getComment().orNull)).toArray[Column]
+ columns.foreach(c => info(s"c is ${c.columnName}, comment is ${c.comment}"))
if (columns == null || columns.isEmpty) return
val metaData = new TableMetaData(columns)
val writer = if (StringUtils.isNotBlank(alias))
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkExecutor.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkExecutor.scala
index 1a9c565dc9..97832b645e 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkExecutor.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkExecutor.scala
@@ -19,12 +19,9 @@ package com.webank.wedatasphere.linkis.engine.executors
import java.io.IOException
import com.webank.wedatasphere.linkis.common.utils.Logging
-import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineExecutorContext}
+import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
import com.webank.wedatasphere.linkis.engine.spark.common.Kind
-import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.executer.ExecuteResponse
-import org.apache.spark.SparkContext
-import org.apache.spark.sql.SQLContext
/**
* Created by allenlliu on 2019/4/8.
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkPythonExecutor.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkPythonExecutor.scala
index 65c5b43c8a..66fd9292f0 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkPythonExecutor.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/executors/SparkPythonExecutor.scala
@@ -23,29 +23,28 @@ import java.util.concurrent.atomic.AtomicLong
import com.webank.wedatasphere.linkis.common.conf.CommonVars
import com.webank.wedatasphere.linkis.common.utils.Utils
import com.webank.wedatasphere.linkis.engine.Interpreter.PythonInterpreter._
-import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration._
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
+import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration._
import com.webank.wedatasphere.linkis.engine.exception.ExecuteError
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
import com.webank.wedatasphere.linkis.engine.imexport.CsvRelation
import com.webank.wedatasphere.linkis.engine.rs.RsOutputStream
import com.webank.wedatasphere.linkis.engine.spark.common.PySpark
import com.webank.wedatasphere.linkis.engine.spark.utils.EngineUtils
-import com.webank.wedatasphere.linkis.scheduler.executer.{ErrorExecuteResponse, ExecuteResponse, SuccessExecuteResponse}
+import com.webank.wedatasphere.linkis.scheduler.executer.{ExecuteResponse, SuccessExecuteResponse}
import com.webank.wedatasphere.linkis.storage.resultset.{ResultSetFactory, ResultSetWriter}
-import org.apache.commons.io.IOUtils
import org.apache.commons.exec.CommandLine
+import org.apache.commons.io.IOUtils
import org.apache.commons.lang.StringUtils
+import org.apache.spark.SparkContext
import org.apache.spark.api.java.JavaSparkContext
-import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{DataFrame, SQLContext, SparkSession}
-import org.apache.spark.{SparkContext, SparkException}
import py4j.GatewayServer
import scala.collection.JavaConversions._
import scala.collection.mutable.StringBuilder
-import scala.concurrent.duration.Duration
import scala.concurrent._
+import scala.concurrent.duration.Duration
/**
* Created by allenlliu on 2018/11/19.
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/factory/SparkEngineExecutorFactory.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/factory/SparkEngineExecutorFactory.scala
index f744236451..02a89bd44f 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/factory/SparkEngineExecutorFactory.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/factory/SparkEngineExecutorFactory.scala
@@ -19,24 +19,19 @@ package com.webank.wedatasphere.linkis.engine.factory
import java.io.File
import java.lang.reflect.Constructor
+import com.webank.wedatasphere.linkis.common.conf.{CommonVars, TimeType}
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
+import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration._
import com.webank.wedatasphere.linkis.engine.exception.SparkSessionNullException
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorFactory
import com.webank.wedatasphere.linkis.engine.executors.{SparkEngineExecutor, SparkPythonExecutor, SparkScalaExecutor, SparkSqlExecutor}
-import com.webank.wedatasphere.linkis.engine.spark.utils.EngineUtils
import com.webank.wedatasphere.linkis.server.JMap
import org.apache.commons.lang.StringUtils
import org.apache.spark.sql.{SQLContext, SparkSession}
+import org.apache.spark.util.SparkUtils
import org.apache.spark.{SparkConf, SparkContext}
import org.springframework.stereotype.Component
-import com.google.common.base.Joiner
-import com.webank.wedatasphere.linkis.common.conf.{CommonVars, TimeType}
-import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
-import org.apache.spark.util.SparkUtils
-
-import scala.collection.mutable.ArrayBuffer
-import scala.collection.JavaConversions._
/**
* Created by allenlliu on 2019/4/8.
*/
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/imexport/CsvRelation.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/imexport/CsvRelation.scala
index 31046e8690..cb9e4eaa25 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/imexport/CsvRelation.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/imexport/CsvRelation.scala
@@ -22,7 +22,7 @@ import java.sql.{Date, Timestamp}
import java.text.SimpleDateFormat
import java.util.Locale
-import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
+import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.imexport.util.ImExportUtils
import org.apache.hadoop.fs.Path
import org.apache.hadoop.io.{IOUtils, LongWritable, Text}
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPostExecutionHook.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPostExecutionHook.scala
index bace449970..d04574f345 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPostExecutionHook.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPostExecutionHook.scala
@@ -15,8 +15,6 @@
*/
package com.webank.wedatasphere.linkis.engine.mdq
-import javax.annotation.PostConstruct
-
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
@@ -26,6 +24,7 @@ import com.webank.wedatasphere.linkis.protocol.mdq.{DDLCompleteResponse, DDLExec
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.executer.{ExecuteResponse, SuccessExecuteResponse}
import com.webank.wedatasphere.linkis.storage.utils.StorageUtils
+import javax.annotation.PostConstruct
import org.apache.commons.lang.StringUtils
import org.springframework.stereotype.Component
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPreExecutionHook.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPreExecutionHook.scala
index e5504fc5fa..de552bc0fe 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPreExecutionHook.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/mdq/MDQPreExecutionHook.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.engine.mdq
import java.util
-import javax.annotation.PostConstruct
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
@@ -27,6 +26,7 @@ import com.webank.wedatasphere.linkis.engine.spark.common.SparkKind
import com.webank.wedatasphere.linkis.protocol.mdq.{DDLRequest, DDLResponse}
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.storage.utils.StorageUtils
+import javax.annotation.PostConstruct
import org.apache.commons.lang.StringUtils
import org.springframework.stereotype.Component
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LineBufferedStream.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LineBufferedStream.scala
index f2b6a85c58..00f8781913 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LineBufferedStream.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LineBufferedStream.scala
@@ -21,7 +21,7 @@ import java.util.concurrent.locks.ReentrantLock
import com.webank.wedatasphere.linkis.common.conf.CommonVars
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
-import com.webank.wedatasphere.linkis.engine.configuration.{SparkConfiguration}
+import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
import org.apache.commons.io.IOUtils
import scala.concurrent.duration.Duration
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LogContainer.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LogContainer.scala
index 4e1d8ec1cd..a4ab282e92 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LogContainer.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/common/LogContainer.scala
@@ -17,8 +17,8 @@
package com.webank.wedatasphere.linkis.engine.spark.common
import scala.collection.Iterable
-import scala.collection.mutable.ArrayBuffer
import scala.collection.JavaConversions._
+import scala.collection.mutable.ArrayBuffer
/**
* Created by allenlliu on 2018/11/19.
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/utils/EngineUtils.scala b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/utils/EngineUtils.scala
index 4c4e3331c8..758473fb3f 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/utils/EngineUtils.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/spark/utils/EngineUtils.scala
@@ -27,9 +27,9 @@ import com.webank.wedatasphere.linkis.common.utils.Utils
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration._
import com.webank.wedatasphere.linkis.engine.spark.common.LineBufferedProcess
import com.webank.wedatasphere.linkis.rpc.Sender
-import com.webank.wedatasphere.linkis.storage.{FSFactory, LineMetaData}
import com.webank.wedatasphere.linkis.storage.resultset.ResultSetReader
import com.webank.wedatasphere.linkis.storage.utils.StorageUtils
+import com.webank.wedatasphere.linkis.storage.{FSFactory, LineMetaData}
import scala.util.Random
diff --git a/ujes/definedEngines/spark/engine/src/main/scala/org/apache/spark/sql/execution/datasources/csv/DolphinToSpark.scala b/ujes/definedEngines/spark/engine/src/main/scala/org/apache/spark/sql/execution/datasources/csv/DolphinToSpark.scala
index 7db344a6c1..3393bc9ee6 100644
--- a/ujes/definedEngines/spark/engine/src/main/scala/org/apache/spark/sql/execution/datasources/csv/DolphinToSpark.scala
+++ b/ujes/definedEngines/spark/engine/src/main/scala/org/apache/spark/sql/execution/datasources/csv/DolphinToSpark.scala
@@ -16,7 +16,6 @@
package org.apache.spark.sql.execution.datasources.csv
-
import java.util
import com.webank.wedatasphere.linkis.engine.configuration.SparkConfiguration
@@ -60,7 +59,7 @@ object DolphinToSpark {
def toSparkType(dataType:wds.DataType):DataType = dataType match {
case wds.NullType => NullType
- //case dwc.StringType | dwc.CharType | dwc.VarcharType | dwc.StructType | dwc.ListType | dwc.ArrayType | dwc.MapType => StringType
+ //case wds.StringType | wds.CharType | wds.VarcharType | wds.StructType | wds.ListType | wds.ArrayType | wds.MapType => StringType
case wds.BooleanType => BooleanType
case wds.ShortIntType => ShortType
case wds.IntType => IntegerType
@@ -69,7 +68,7 @@ object DolphinToSpark {
case wds.DoubleType => DoubleType
case wds.DecimalType => DecimalType(bigDecimalPrecision,bigDecimalScale)
case wds.DateType => DateType
- case wds.TimestampType => TimestampType
+ //case wds.TimestampType => TimestampType
case wds.BinaryType => BinaryType
case _ => StringType
}
diff --git a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkConfiguration.scala b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkConfiguration.scala
index 320cec61fd..1f6a28940c 100644
--- a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkConfiguration.scala
+++ b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkConfiguration.scala
@@ -16,12 +16,10 @@
package com.webank.wedatasphere.linkis.enginemanager.configuration
-
import com.webank.wedatasphere.linkis.common.conf.{CommonVars, Configuration}
import com.webank.wedatasphere.linkis.common.utils.{ClassUtils, Logging}
import com.webank.wedatasphere.linkis.engine.factory.SparkEngineExecutorFactory
import com.webank.wedatasphere.linkis.enginemanager.AbstractEngineCreator
-import com.webank.wedatasphere.linkis.enginemanager.process.{JavaProcessEngineBuilder, SparkSubmitProcessBuilder}
import scala.collection.mutable.ArrayBuffer
/**
diff --git a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkEngineManagerSpringConfiguration.scala b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkEngineManagerSpringConfiguration.scala
index af085136a9..cb2bb5af3a 100644
--- a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkEngineManagerSpringConfiguration.scala
+++ b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/configuration/SparkEngineManagerSpringConfiguration.scala
@@ -22,7 +22,6 @@ import com.webank.wedatasphere.linkis.enginemanager.hook._
import com.webank.wedatasphere.linkis.resourcemanager.domain.ModuleInfo
import com.webank.wedatasphere.linkis.resourcemanager.{DriverAndYarnResource, LoadInstanceResource, ResourceRequestPolicy}
import com.webank.wedatasphere.linkis.rpc.Sender
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.{Bean, Configuration}
/**
diff --git a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkEngineCreator.scala b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkEngineCreator.scala
index 1f338e8623..5aaef2f19c 100644
--- a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkEngineCreator.scala
+++ b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkEngineCreator.scala
@@ -18,11 +18,8 @@ package com.webank.wedatasphere.linkis.enginemanager.process
import com.webank.wedatasphere.linkis.common.conf.DWCArgumentsParser
import com.webank.wedatasphere.linkis.common.utils.Logging
-import com.webank.wedatasphere.linkis.enginemanager.conf.EngineManagerConfiguration
+import com.webank.wedatasphere.linkis.enginemanager.AbstractEngineCreator
import com.webank.wedatasphere.linkis.enginemanager.impl.UserTimeoutEngineResource
-import com.webank.wedatasphere.linkis.enginemanager.{AbstractEngineCreator, Engine, EngineManagerReceiver, EngineResource}
-import com.webank.wedatasphere.linkis.protocol.engine.{EngineCallback, RequestEngine}
-import com.webank.wedatasphere.linkis.rpc.Sender
import org.springframework.stereotype.Component
/**
diff --git a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkSubmitProcessBuilder.scala b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkSubmitProcessBuilder.scala
index 99bac971da..ae678d1327 100644
--- a/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkSubmitProcessBuilder.scala
+++ b/ujes/definedEngines/spark/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/process/SparkSubmitProcessBuilder.scala
@@ -19,7 +19,7 @@ package com.webank.wedatasphere.linkis.enginemanager.process
import java.lang.ProcessBuilder.Redirect
-import com.webank.wedatasphere.linkis.common.utils.{ByteTimeUtils, Logging}
+import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.enginemanager.EngineResource
import com.webank.wedatasphere.linkis.enginemanager.conf.EnvConfiguration._
import com.webank.wedatasphere.linkis.enginemanager.configuration.SparkConfiguration
@@ -29,7 +29,6 @@ import com.webank.wedatasphere.linkis.enginemanager.impl.UserEngineResource
import com.webank.wedatasphere.linkis.enginemanager.process.SparkSubmitProcessBuilder.{AbsolutePath, Path, RelativePath}
import com.webank.wedatasphere.linkis.protocol.engine.RequestEngine
import com.webank.wedatasphere.linkis.resourcemanager.DriverAndYarnResource
-import org.apache.commons.lang.StringUtils
import scala.collection.mutable.ArrayBuffer
@@ -135,7 +134,7 @@ class SparkSubmitProcessBuilder extends ProcessEngineBuilder with Logging {
this.deployMode("client")
val driverJavaSet = "\"-Dwds.linkis.configuration=linkis-engine.properties " + SparkConfiguration.getJavaRemotePort + "\""
this.conf(SPARK_DRIVER_EXTRA_JAVA_OPTIONS.key, driverJavaSet)
- this.name(properties.getOrDefault("appName", "sparksqltest"))
+ this.name(properties.getOrDefault("appName", "linkis"))
this.className(properties.getOrDefault("className", "com.webank.wedatasphere.linkis.engine.DataWorkCloudEngineApplication"))
properties.getOrDefault("archives", "").toString.split(",").map(RelativePath).foreach(this.archive)
this.driverCores(DWC_SPARK_DRIVER_CORES)
@@ -153,7 +152,7 @@ class SparkSubmitProcessBuilder extends ProcessEngineBuilder with Logging {
this.driverClassPath(SPARK_DRIVER_CLASSPATH.getValue)
this.redirectOutput(Redirect.PIPE)
this.redirectErrorStream(true)
- this.env("spark.app.name", properties.getOrDefault("appName", "dwc" + request.creator))
+ this.env("spark.app.name", properties.getOrDefault("appName", "linkis" + request.creator))
}
diff --git a/ujes/definedEngines/spark/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/job/SparkEntranceJob.scala b/ujes/definedEngines/spark/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/job/SparkEntranceJob.scala
index 500cb40f4b..c522d64ca7 100644
--- a/ujes/definedEngines/spark/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/job/SparkEntranceJob.scala
+++ b/ujes/definedEngines/spark/entrance/src/main/scala/com/webank/wedatasphere/linkis/entrance/job/SparkEntranceJob.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.entrance.job
-
/**
* Created by allenlliu on 2018/12/5.
*/
diff --git a/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/configuration/TiSparkSpringConfiguration.scala b/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/configuration/TiSparkSpringConfiguration.scala
index 75ab5400b9..664308d18b 100644
--- a/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/configuration/TiSparkSpringConfiguration.scala
+++ b/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/configuration/TiSparkSpringConfiguration.scala
@@ -16,11 +16,6 @@
package com.webank.wedatasphere.linkis.tispark.engine.configuration
-import com.webank.wedatasphere.linkis.engine.execute.EngineHook
-import com.webank.wedatasphere.linkis.engine.execute.hook._
-import com.webank.wedatasphere.linkis.tispark.engine.hook.{TiSparkHook, UserDataBaseHook}
-import org.springframework.context.annotation.{Bean, Configuration}
-
/**
* Created by johnnwang on 2019/6/26.
*/
diff --git a/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/hook/TiSparkHook.scala b/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/hook/TiSparkHook.scala
index d1eafba8e3..7c8177bde1 100644
--- a/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/hook/TiSparkHook.scala
+++ b/ujes/definedEngines/tispark/engine/src/main/scala/com/webank/wedatasphere/linkis/tispark/engine/hook/TiSparkHook.scala
@@ -16,13 +16,6 @@
package com.webank.wedatasphere.linkis.tispark.engine.hook
-import com.webank.wedatasphere.linkis.common.utils.Logging
-import com.webank.wedatasphere.linkis.engine.exception.EngineErrorException
-import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineHook}
-import com.webank.wedatasphere.linkis.scheduler.executer.{ExecuteRequest, RunTypeExecuteRequest}
-import com.webank.wedatasphere.linkis.server.JMap
-import org.apache.commons.lang.StringUtils
-
/**
* Created by johnnwang on 2019/6/26.
*/
diff --git a/ujes/engine/pom.xml b/ujes/engine/pom.xml
index 9fa05dbcbb..3b52059131 100644
--- a/ujes/engine/pom.xml
+++ b/ujes/engine/pom.xml
@@ -80,6 +80,11 @@
test
+
+ com.webank.wedatasphere.linkis
+ linkis-cs-ujes-client
+ ${linkis.version}
+
diff --git a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/LogCache.java b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/LogCache.java
index adcc6cd609..63b67fba23 100644
--- a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/LogCache.java
+++ b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/LogCache.java
@@ -17,8 +17,6 @@
package com.webank.wedatasphere.linkis.engine.log;
-import org.apache.logging.log4j.core.LogEvent;
-
import java.util.List;
/**
diff --git a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/MountLogCache.java b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/MountLogCache.java
index fb897025e6..5512ce525d 100644
--- a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/MountLogCache.java
+++ b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/MountLogCache.java
@@ -18,8 +18,6 @@
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration$;
import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.core.LogEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -121,7 +119,7 @@ public List getLog(int num) {
}
@Override
- public List getRemain() {
+ public synchronized List getRemain() {
return logs.getRemain();
}
diff --git a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/RPCAppender.java b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/RPCAppender.java
index d418ba4293..e7482f6b7f 100644
--- a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/RPCAppender.java
+++ b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/RPCAppender.java
@@ -22,18 +22,10 @@
*/
package com.webank.wedatasphere.linkis.engine.log;
-import com.webank.wedatasphere.linkis.engine.EngineReceiver;
import com.webank.wedatasphere.linkis.rpc.Sender;
import com.webank.wedatasphere.linkis.scheduler.listener.LogListener;
-import com.webank.wedatasphere.linkis.scheduler.queue.Job;
-import com.webank.wedatasphere.linkis.server.Message;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
public class RPCAppender extends AppenderSkeleton {
diff --git a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/SendAppender.java b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/SendAppender.java
index 3b47153d4b..2fe1c88922 100644
--- a/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/SendAppender.java
+++ b/ujes/engine/src/main/java/com/webank/wedatasphere/linkis/engine/log/SendAppender.java
@@ -20,6 +20,7 @@
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration;
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration$;
import com.webank.wedatasphere.linkis.scheduler.listener.LogListener;
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.LogEvent;
@@ -51,25 +52,33 @@ public class SendAppender extends AbstractAppender {
private LogCache logCache;
private static final Logger logger = LoggerFactory.getLogger(SendAppender.class);
+ private static final String IGNORE_WORDS = EngineConfiguration.ENGINE_IGNORE_WORDS().getValue();
+
+ private static final String[] IGNORE_WORD_ARR = IGNORE_WORDS.split(",");
+
+ private static final String PASS_WORDS = EngineConfiguration.ENGINE_PASS_WORDS().getValue();
+
+ private static final String[] PASS_WORDS_ARR = PASS_WORDS.split(",");
+
class SendThread implements Runnable{
@Override
public void run() {
- if (logListener == null){
+ if (logListener == null){
//ignore
- }else{
- if (logCache == null){
- logger.warn("logCache is null");
- return;
- }
- List logs = logCache.getRemain();
- if (logs.size() > 0){
- StringBuilder sb = new StringBuilder();
- for(String log : logs){
- sb.append(log);
- }
- logListener.onLogUpdate(null, sb.toString());
- }
- }
+ }else{
+ if (logCache == null){
+ logger.warn("logCache is null");
+ return;
+ }
+ List logs = logCache.getRemain();
+ if (logs.size() > 0){
+ StringBuilder sb = new StringBuilder();
+ for(String log : logs){
+ sb.append(log).append("\n");
+ }
+ logListener.onLogUpdate(null, sb.toString());
+ }
+ }
}
}
@@ -77,8 +86,7 @@ public void run() {
public SendAppender(final String name, final Filter filter, final Layout extends Serializable> layout,
final boolean ignoreExceptions) {
super(name, filter, layout, ignoreExceptions);
- //todo enjoyyin 500 to be made configurable ide number(500要做成可配置ide数字)
- //this.logCache = new MountLogCache((Integer) EngineConfiguration.ENGINE_LOG_CACHE_NUM().getValue());
+ //todo cooperyang 500要做成可配置ide数字
this.logCache = LogHelper.logCache();
SendThread thread = new SendThread();
Utils.defaultScheduler().scheduleAtFixedRate(thread, 10, (Integer)EngineConfiguration$.MODULE$.ENGINE_LOG_SEND_TIME_INTERVAL().getValue(), TimeUnit.MILLISECONDS);
@@ -88,16 +96,34 @@ public static void setLogListener(LogListener ll){
logListener = ll;
}
-// public static void setLogCache(LogCache lc){
-// logCache = lc;
-// }
+
@Override
public void append(LogEvent event) {
if (logListener == null) {
return;
}
- logCache.cacheLog(new String(getLayout().toByteArray(event)));
+ String logStr = new String(getLayout().toByteArray(event));
+ if (event.getLevel().intLevel() == Level.INFO.intLevel()){
+ boolean flag = false;
+ for(String ignoreLog : IGNORE_WORD_ARR){
+ if (logStr.contains(ignoreLog)){
+ flag = true;
+ break;
+ }
+ }
+ for(String word : PASS_WORDS_ARR){
+ if(logStr.contains(word)){
+ flag = false;
+ break;
+ }
+ }
+ if (!flag) {
+ logCache.cacheLog(logStr);
+ }
+ }else{
+ logCache.cacheLog(logStr);
+ }
}
@PluginFactory
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineReceiver.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineReceiver.scala
index 255ac59746..006bad7bfe 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineReceiver.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineReceiver.scala
@@ -17,7 +17,7 @@
package com.webank.wedatasphere.linkis.engine
import java.lang.management.ManagementFactory
-import java.util.concurrent.{Future, ScheduledFuture, TimeUnit}
+import java.util.concurrent.{Future, TimeUnit}
import com.webank.wedatasphere.linkis.common.ServiceInstance
import com.webank.wedatasphere.linkis.common.conf.DWCArgumentsParser
@@ -28,7 +28,7 @@ import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration.{ENGINE_PU
import com.webank.wedatasphere.linkis.engine.exception.{EngineErrorException, JobNotExistsException}
import com.webank.wedatasphere.linkis.engine.execute.scheduler.EngineGroupFactory
import com.webank.wedatasphere.linkis.engine.execute.{CommonEngineJob, _}
-import com.webank.wedatasphere.linkis.engine.log.{LogHelper, MountLogCache, SendAppender}
+import com.webank.wedatasphere.linkis.engine.log.{LogHelper, SendAppender}
import com.webank.wedatasphere.linkis.protocol.UserWithCreator
import com.webank.wedatasphere.linkis.protocol.engine._
import com.webank.wedatasphere.linkis.resourcemanager.UserResultResource
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServer.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServer.scala
index 0ab3454c52..d5ffb82cf5 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServer.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServer.scala
@@ -19,7 +19,6 @@ package com.webank.wedatasphere.linkis.engine
import java.io.Closeable
import com.webank.wedatasphere.linkis.common.utils.Logging
-import javax.annotation.PreDestroy
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServerSpringConfiguration.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServerSpringConfiguration.scala
index bec668c87e..f873e83d41 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServerSpringConfiguration.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/EngineServerSpringConfiguration.scala
@@ -26,7 +26,6 @@ import com.webank.wedatasphere.linkis.protocol.engine.RequestTask
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.SchedulerContext
import com.webank.wedatasphere.linkis.scheduler.queue.Job
-import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.{Bean, Configuration}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/LockManager.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/LockManager.scala
index 42b2c244be..69e59b7524 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/LockManager.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/LockManager.scala
@@ -17,7 +17,6 @@
package com.webank.wedatasphere.linkis.engine
import com.webank.wedatasphere.linkis.scheduler.SchedulerContext
-import com.webank.wedatasphere.linkis.scheduler.executer.Executor
/**
* Created by enjoyyin on 2018/9/3.
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PropertiesExecuteRequest.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PropertiesExecuteRequest.scala
new file mode 100644
index 0000000000..790e037891
--- /dev/null
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/PropertiesExecuteRequest.scala
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine
+
+/**
+ * @author peacewong
+ * @date 2020/3/5 17:28
+ */
+trait PropertiesExecuteRequest {
+ val properties: java.util.Map[String, Object]
+}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ResourceExecuteRequest.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ResourceExecuteRequest.scala
index 52d2998222..9c1dfd6623 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ResourceExecuteRequest.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/ResourceExecuteRequest.scala
@@ -5,5 +5,5 @@ package com.webank.wedatasphere.linkis.engine
* Description:
*/
trait ResourceExecuteRequest {
- val resources:java.util.List[Object]
+ def resources:java.util.List[Object]
}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/conf/EngineConfiguration.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/conf/EngineConfiguration.scala
index 3de772fc8e..25e5e7f64c 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/conf/EngineConfiguration.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/conf/EngineConfiguration.scala
@@ -60,4 +60,10 @@ object EngineConfiguration {
val ENGINE_PUSH_PROGRESS_TO_ENTRANCE = CommonVars("wds.linkis.engine.push.progress.enable", true)
val ENGINE_PRE_EXECUTE_HOOK_CLASSES = CommonVars("wds.linkis.engine.pre.hook.class", "com.webank.wedatasphere.linkis.bml.hook.BmlEnginePreExecuteHook")
+
+ val ENGINE_IGNORE_WORDS = CommonVars("wds.linkis.engine.ignore.words", "org.apache.spark.deploy.yarn.Client")
+
+ val ENGINE_PASS_WORDS = CommonVars("wds.linkis.engine.pass.words", "org.apache.hadoop.hive.ql.exec.Task")
+
+ val ENGINE_TUNING_DX_PERIOD = CommonVars("wds.linkis.engine.tuning.dx.period", 1000*60*5)
}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSEnginePreExecuteHook.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSEnginePreExecuteHook.scala
new file mode 100644
index 0000000000..ac08532172
--- /dev/null
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSEnginePreExecuteHook.scala
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.cs
+
+import com.webank.wedatasphere.linkis.common.utils.Logging
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextServiceUtils
+import com.webank.wedatasphere.linkis.cs.common.utils.CSCommonUtils
+import com.webank.wedatasphere.linkis.engine.PropertiesExecuteRequest
+import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
+import com.webank.wedatasphere.linkis.engine.extension.EnginePreExecuteHook
+import com.webank.wedatasphere.linkis.scheduler.executer.ExecuteRequest
+
+/**
+ * @author peacewong
+ * @date 2020/3/5 17:13
+ */
+class CSEnginePreExecuteHook extends EnginePreExecuteHook with Logging {
+
+ private val csResourceParser: CSResourceParser = new CSResourceParser
+
+ override val hookName: String = "ContextServicePreHook"
+
+
+ override def callPreExecuteHook(engineExecutorContext: EngineExecutorContext, executeRequest: ExecuteRequest, code: String): String = executeRequest match {
+ case propertiesExecuteRequest: PropertiesExecuteRequest =>
+ var parsedCode = code
+ val contextIDValueStr = ContextServiceUtils.getContextIDStrByMap(propertiesExecuteRequest.properties)
+ val nodeNameStr = ContextServiceUtils.getNodeNameStrByMap(propertiesExecuteRequest.properties)
+ engineExecutorContext.addProperty(CSCommonUtils.CONTEXT_ID_STR, contextIDValueStr)
+ engineExecutorContext.addProperty(CSCommonUtils.NODE_NAME_STR, nodeNameStr)
+ info(s"Start to call cs engine pre hook,contextID is $contextIDValueStr, nodeNameStr is $nodeNameStr")
+ parsedCode = csResourceParser.parse(propertiesExecuteRequest, parsedCode, contextIDValueStr, nodeNameStr)
+
+ info(s"Finished to call cs engine pre hook,contextID is $contextIDValueStr, nodeNameStr is $nodeNameStr")
+ parsedCode
+ case _ => code
+ }
+}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSResourceParser.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSResourceParser.scala
new file mode 100644
index 0000000000..df09dfc170
--- /dev/null
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSResourceParser.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.cs
+
+
+import java.util
+import java.util.regex.Pattern
+
+import com.webank.wedatasphere.linkis.cs.client.service.CSResourceService
+import com.webank.wedatasphere.linkis.engine.PropertiesExecuteRequest
+import org.apache.commons.lang.StringUtils
+
+import scala.collection.JavaConversions._
+import scala.collection.mutable.ArrayBuffer
+
+/**
+ * @author peacewong
+ * @date 2020/3/5 19:42
+ */
+class CSResourceParser {
+
+ private val pb = Pattern.compile("cs://[^\\s\"]+[$\\s]{0,1}", Pattern.CASE_INSENSITIVE)
+
+ private val PREFIX = "cs://"
+
+ private def getPreFixResourceNames(code: String): Array[String] = {
+ val bmlResourceNames = new ArrayBuffer[String]()
+ val mb = pb.matcher(code)
+ while (mb.find) bmlResourceNames.append(mb.group.trim)
+ bmlResourceNames.toArray
+ }
+
+ def parse(executeRequest: PropertiesExecuteRequest, code: String, contextIDValueStr: String, nodeNameStr: String): String = {
+
+ //TODO getBMLResource peaceWong
+ val bmlResourceList = CSResourceService.getInstance().getUpstreamBMLResource(contextIDValueStr, nodeNameStr)
+
+ val parsedResources = new util.ArrayList[util.Map[String, Object]]()
+ val preFixResourceNames = getPreFixResourceNames(code)
+
+ val preFixNames = new ArrayBuffer[String]()
+ val parsedNames = new ArrayBuffer[String]()
+ preFixResourceNames.foreach { preFixResourceName =>
+ val resourceName = preFixResourceName.replace(PREFIX, "").trim
+ val bmlResourceOption = bmlResourceList.find(_.getDownloadedFileName.equals(resourceName))
+ if (bmlResourceOption.isDefined) {
+ val bmlResource = bmlResourceOption.get
+ val map = new util.HashMap[String, Object]()
+ map.put("resourceId", bmlResource.getResourceId)
+ map.put("version", bmlResource.getVersion)
+ map.put("fileName", resourceName)
+ parsedResources.add(map)
+ preFixNames.append(preFixResourceName)
+ parsedNames.append(resourceName)
+ }
+
+ }
+ executeRequest.properties.put("resources", parsedResources)
+ StringUtils.replaceEach(code, preFixNames.toArray, parsedNames.toArray)
+ }
+
+}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableRegister.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableRegister.scala
new file mode 100644
index 0000000000..e6c4dadc87
--- /dev/null
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/cs/CSTableRegister.scala
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2019 WeBank
+ * Licensed 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 com.webank.wedatasphere.linkis.engine.cs
+
+import java.util.Date
+
+import com.webank.wedatasphere.linkis.common.io.resultset.ResultSetWriter
+import com.webank.wedatasphere.linkis.common.io.{MetaData, Record}
+import com.webank.wedatasphere.linkis.common.utils.Logging
+import com.webank.wedatasphere.linkis.cs.client.service.CSTableService
+import com.webank.wedatasphere.linkis.cs.client.utils.{ContextServiceUtils, SerializeHelper}
+import com.webank.wedatasphere.linkis.cs.common.entity.enumeration.{ContextScope, ContextType}
+import com.webank.wedatasphere.linkis.cs.common.entity.metadata.{CSColumn, CSTable}
+import com.webank.wedatasphere.linkis.cs.common.entity.source.CommonContextKey
+import com.webank.wedatasphere.linkis.cs.common.utils.CSCommonUtils
+import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorContext
+import com.webank.wedatasphere.linkis.storage.domain.Column
+import com.webank.wedatasphere.linkis.storage.utils.StorageUtils
+import org.apache.commons.lang.StringUtils
+
+/**
+ * @author peacewong
+ * @date 2020/3/13 16:29
+ */
+object CSTableRegister extends Logging{
+
+ def registerTempTable(engineExecutorContext: EngineExecutorContext,
+ writer: ResultSetWriter[_ <: MetaData, _ <: Record], alias: String, columns: Array[Column]): Unit = {
+
+ val contextIDValueStr = ContextServiceUtils.getContextIDStrByMap(engineExecutorContext.getProperties)
+ val nodeNameStr = ContextServiceUtils.getNodeNameStrByMap(engineExecutorContext.getProperties)
+
+ if (StringUtils.isNotBlank(contextIDValueStr) && StringUtils.isNotBlank(nodeNameStr)) {
+ info(s"Start to register TempTable nodeName:$nodeNameStr")
+ writer.flush()
+ val tableName = if (StringUtils.isNotBlank(alias)) s"${CSCommonUtils.CS_TMP_TABLE_PREFIX}${nodeNameStr}_${alias}" else {
+ var i = 1;
+ var rsName: String = null;
+ while (StringUtils.isEmpty(rsName)) {
+ val tmpTable = s"${CSCommonUtils.CS_TMP_TABLE_PREFIX}${nodeNameStr}_rs${i}"
+ i = i + 1
+ val contextKey = new CommonContextKey
+ contextKey.setContextScope(ContextScope.FRIENDLY)
+ contextKey.setContextType(ContextType.METADATA)
+ contextKey.setKey(CSCommonUtils.getTableKey(nodeNameStr, tmpTable))
+ val table = CSTableService.getInstance().getCSTable(contextIDValueStr, SerializeHelper.serializeContextKey(contextKey))
+ if (null == table) {
+ rsName = tmpTable
+ }
+ }
+ rsName
+ }
+ val csTable = new CSTable
+ csTable.setName(tableName)
+ csTable.setAlias(alias)
+ csTable.setAvailable(true)
+ csTable.setComment("cs temp table")
+ csTable.setCreateTime(new Date())
+ csTable.setCreator(StorageUtils.getJvmUser)
+ csTable.setExternalUse(true)
+ csTable.setImport(false)
+ csTable.setLocation(writer.toString)
+ csTable.setPartitionTable(false)
+ csTable.setView(true)
+ val csColumns = columns.map { column =>
+ val csColumn = new CSColumn
+ csColumn.setName(column.columnName)
+ csColumn.setType(column.dataType.typeName)
+ csColumn.setComment(column.comment)
+ csColumn
+ }
+ csTable.setColumns(csColumns)
+ val contextKey = new CommonContextKey
+ contextKey.setContextScope(ContextScope.PUBLIC)
+ contextKey.setContextType(ContextType.METADATA)
+ contextKey.setKey(CSCommonUtils.getTableKey(nodeNameStr, tableName))
+ CSTableService.getInstance().putCSTable(contextIDValueStr, SerializeHelper.serializeContextKey(contextKey), csTable)
+ info(s"Finished to register TempTable nodeName:$nodeNameStr")
+ }
+ }
+}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/CodeParser.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/CodeParser.scala
index 3652e31e3f..e60b6e27a7 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/CodeParser.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/CodeParser.scala
@@ -23,7 +23,6 @@ import com.webank.wedatasphere.linkis.engine.execute.CodeType.CodeType
import org.apache.commons.lang.StringUtils
import org.slf4j.{Logger, LoggerFactory}
-import scala.collection.immutable.HashSet
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
@@ -101,8 +100,11 @@ class PythonCodeParser extends SingleCodeParser {
statementBuffer.append(l)
recordBrackets(bracketStack, l)
case l if quotationMarks => statementBuffer.append(l)
- recordBrackets(bracketStack, l)
+ //shanhuang 用于修复python的引号问题
+ //recordBrackets(bracketStack, l)
case l if notDoc && l.startsWith("#") =>
+ case l if StringUtils.isNotBlank(statementBuffer.last) && statementBuffer.last.endsWith("""\""") =>
+ statementBuffer.append(l)
case l if notDoc && l.startsWith(" ") =>
statementBuffer.append(l)
recordBrackets(bracketStack, l.trim)
@@ -180,13 +182,13 @@ class SQLCodeParser extends SingleCodeParser {
if (StringUtils.contains(code, separator)) {
StringUtils.split(code, ";").foreach{
case s if StringUtils.isBlank(s) =>
- case s if isSelectCmdNoLimit(s) => appendStatement(s + " limit " + defaultLimit);
+ case s if isSelectCmdNoLimit(s) => appendStatement(s);
case s => appendStatement(s);
}
} else {
code match {
case s if StringUtils.isBlank(s) =>
- case s if isSelectCmdNoLimit(s) => appendStatement(s + " limit " + defaultLimit);
+ case s if isSelectCmdNoLimit(s) => appendStatement(s);
case s => appendStatement(s);
}
}
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutor.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutor.scala
index 95c4107c0e..83b7f18f6c 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutor.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutor.scala
@@ -16,10 +16,8 @@
package com.webank.wedatasphere.linkis.engine.execute
-import com.webank.wedatasphere.linkis.common.log.LogUtils
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration
-import com.webank.wedatasphere.linkis.engine.exception.EngineErrorException
import com.webank.wedatasphere.linkis.engine.extension.EnginePreExecuteHook
import com.webank.wedatasphere.linkis.resourcemanager.Resource
import com.webank.wedatasphere.linkis.scheduler.executer._
@@ -49,14 +47,14 @@ abstract class EngineExecutor(outputPrintLimit: Int, isSupportParallelism: Boole
val hooks = new ArrayBuffer[EnginePreExecuteHook]()
EngineConfiguration.ENGINE_PRE_EXECUTE_HOOK_CLASSES.getValue.split(",") foreach {
hookStr => Utils.tryCatch{
- val clazz = Class.forName(hookStr)
+ val clazz = Class.forName(hookStr.trim)
val obj = clazz.newInstance()
obj match {
case hook:EnginePreExecuteHook => hooks += hook
case _ => logger.warn(s"obj is not a engineHook obj is ${obj.getClass}")
}
}{
- case e:Exception => logger.error("failed to load class", e)
+ case e:Exception => logger.error(s"failed to load class ${hookStr}")
}
}
hooks.toArray
@@ -117,20 +115,22 @@ abstract class EngineExecutor(outputPrintLimit: Int, isSupportParallelism: Boole
else if(isSupportParallelism) whenAvailable(f) else ensureIdle(f)
ensureOp {
val engineExecutorContext = createEngineExecutorContext(executeRequest)
+ var hookedCode = executeRequest.code;
Utils.tryCatch{
enginePreExecuteHooks foreach {
hook => logger.info(s"${hook.hookName} begins to do a hook")
- hook.callPreExecuteHook(engineExecutorContext, executeRequest)
+ hookedCode = hook.callPreExecuteHook(engineExecutorContext, executeRequest, hookedCode)
logger.info(s"${hook.hookName} ends to do a hook")
}
}{
- case e:Exception => logger.info("failed to do with hook")
+ case e:Throwable => logger.info("failed to do with hook", e)
}
+ info(s"hooked after code:$hookedCode")
var response: ExecuteResponse = null
val incomplete = new StringBuilder
- val codes = Utils.tryCatch(codeParser.map(_.parse(executeRequest.code, engineExecutorContext)).getOrElse(Array(executeRequest.code))){
- e => warn("Your code failed to commit one line at a time, and is now ready to execute as a full commit(您的代码在进行一行一行代码提交时失败,现在准备按照全部提交的方式进行执行)",e)
- Array(executeRequest.code)
+ val codes = Utils.tryCatch(codeParser.map(_.parse(hookedCode, engineExecutorContext)).getOrElse(Array(hookedCode))){
+ e => info("Your code will be submitted in overall mode")
+ Array(hookedCode)
}
engineExecutorContext.setTotalParagraph(codes.length)
codes.indices.foreach { index =>
@@ -145,7 +145,7 @@ abstract class EngineExecutor(outputPrintLimit: Int, isSupportParallelism: Boole
//engineExecutorContext.appendStdout(getName + ">> " + incomplete.toString().trim + " complete ")
response match {
case e: ErrorExecuteResponse =>
- error(s"execute code $code failed!", e.t)
+ error(s"execute code failed!", e.t)
return response
case SuccessExecuteResponse() =>
engineExecutorContext.appendStdout("\n")
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorContext.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorContext.scala
index 2e9a43c5dc..f4e87dd1bf 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorContext.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorContext.scala
@@ -23,11 +23,14 @@ import java.util.concurrent.atomic.AtomicInteger
import com.webank.wedatasphere.linkis.common.io.resultset.{ResultSet, ResultSetWriter}
import com.webank.wedatasphere.linkis.common.io.{FsPath, MetaData, Record}
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
+import com.webank.wedatasphere.linkis.cs.client.utils.ContextServiceUtils
+import com.webank.wedatasphere.linkis.cs.storage.CSTableResultSetWriter
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration.{ENGINE_RESULT_SET_MAX_CACHE, ENGINE_RESULT_SET_STORE_PATH}
import com.webank.wedatasphere.linkis.engine.exception.EngineErrorException
import com.webank.wedatasphere.linkis.protocol.engine.JobProgressInfo
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.executer.{AliasOutputExecuteResponse, OutputExecuteResponse}
+import com.webank.wedatasphere.linkis.storage.resultset.table.TableResultSet
import com.webank.wedatasphere.linkis.storage.resultset.{ResultSetFactory, ResultSetWriter}
import com.webank.wedatasphere.linkis.storage.{LineMetaData, LineRecord}
import org.apache.commons.io.IOUtils
@@ -36,7 +39,7 @@ import org.apache.commons.lang.time.DateFormatUtils
import scala.collection.mutable.ArrayBuffer
-class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
+class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging {
private val resultSetFactory = ResultSetFactory.getInstance
private val resultSetWriters = ArrayBuffer[ResultSetWriter[_ <: MetaData, _ <: Record]]()
@@ -48,17 +51,21 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
private val aliasNum = new AtomicInteger(0)
protected var storePath: Option[String] = None
- private val properties:java.util.Map[String,Object] = new util.HashMap[String, Object]()
+ private val properties: java.util.Map[String, Object] = new util.HashMap[String, Object]()
private var totalParagraph = 0
private var currentParagraph = 0
def kill(): Unit = interrupted = true
+
def isKilled: Boolean = interrupted
def getTotalParagraph: Int = totalParagraph
+
def setTotalParagraph(totalParagraph: Int): Unit = this.totalParagraph = totalParagraph
+
def getCurrentParagraph: Int = currentParagraph
+
def setCurrentParagraph(currentParagraph: Int): Unit = this.currentParagraph = currentParagraph
def pushProgress(progress: Float, progressInfo: Array[JobProgressInfo]): Unit =
@@ -66,10 +73,10 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
def sendResultSet(resultSetWriter: ResultSetWriter[_ <: MetaData, _ <: Record]): Unit = {
val fileName = new File(resultSetWriter.toFSPath.getPath).getName
- val index = if(fileName.indexOf(".") < 0) fileName.length else fileName.indexOf(".")
- val alias = if(fileName.startsWith("_")) fileName.substring(1, index) else fileName.substring(0, fileName.indexOf("_"))
-// resultSetWriter.flush()
- Utils.tryFinally(sendResultSet(resultSetWriter.toString(), alias)){
+ val index = if (fileName.indexOf(".") < 0) fileName.length else fileName.indexOf(".")
+ val alias = if (fileName.startsWith("_")) fileName.substring(1, index) else fileName.substring(0, fileName.indexOf("_"))
+ // resultSetWriter.flush()
+ Utils.tryFinally(sendResultSet(resultSetWriter.toString(), alias)) {
IOUtils.closeQuietly(resultSetWriter)
resultSetWriters synchronized resultSetWriters -= resultSetWriter
}
@@ -78,8 +85,8 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
def sendResultSet(output: String): Unit = sendResultSet(output, "_" + aliasNum.getAndIncrement())
def appendTextResultSet(output: String): Unit = {
- if(defaultResultSetWriter == null) aliasNum synchronized {
- if(defaultResultSetWriter == null) {
+ if (defaultResultSetWriter == null) aliasNum synchronized {
+ if (defaultResultSetWriter == null) {
defaultResultSetWriter = createDefaultResultSetWriter(ResultSetFactory.TEXT_TYPE)
defaultResultSetWriter.addMetaData(new LineMetaData())
resultSetWriters += defaultResultSetWriter
@@ -91,12 +98,12 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
private def sendResultSet(output: String, alias: String): Unit = {
if (StringUtils.isEmpty(output)) return
if (resultSetFactory.isResultSetPath(output))
- engineExecutor.getResultSetListener.foreach{ l =>
+ engineExecutor.getResultSetListener.foreach { l =>
jobId.foreach(l.onResultSetCreated(_, output, alias))
resultSize += 1
}
else if (resultSetFactory.isResultSet(output))
- engineExecutor.getResultSetListener.foreach{ l =>
+ engineExecutor.getResultSetListener.foreach { l =>
jobId.foreach(l.onResultSetCreated(_, output, alias))
resultSize += 1
}
@@ -104,7 +111,9 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
}
def setJobId(jobId: String) = this.jobId = Option(jobId)
+
def getJobId = jobId
+
def setStorePath(storePath: String) = this.storePath = Option(storePath)
def sendResultSet(outputExecuteResponse: OutputExecuteResponse): Unit = outputExecuteResponse match {
@@ -112,13 +121,13 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
case output: OutputExecuteResponse => sendResultSet(output.getOutput, "_" + aliasNum.getAndIncrement())
}
- def getProperties:java.util.Map[String, Object] = properties
+ def getProperties: java.util.Map[String, Object] = properties
- def addProperty(key:String, value:String):Unit = properties.put(key, value)
+ def addProperty(key: String, value: String): Unit = properties.put(key, value)
protected def getDefaultStorePath: String = {
val path = ENGINE_RESULT_SET_STORE_PATH.getValue
- (if(path.endsWith("/")) path else path + "/") + "user" + "/" +
+ (if (path.endsWith("/")) path else path + "/") + "user" + "/" +
DateFormatUtils.format(System.currentTimeMillis(), "yyyyMMdd") + "/" + Sender.getThisServiceInstance.getApplicationName +
"/" + System.nanoTime
}
@@ -139,16 +148,34 @@ class EngineExecutorContext(engineExecutor: EngineExecutor) extends Logging{
def createResultSetWriter(resultSet: ResultSet[_ <: MetaData, _ <: Record], alias: String): ResultSetWriter[_ <: MetaData, _ <: Record] = {
val filePath = storePath.getOrElse(getDefaultStorePath)
- val fileName = if(StringUtils.isEmpty(alias)) "_" + aliasNum.getAndIncrement() else alias + "_" + aliasNum.getAndIncrement()
+ val fileName = if (StringUtils.isEmpty(alias)) "_" + aliasNum.getAndIncrement() else alias + "_" + aliasNum.getAndIncrement()
val resultSetPath = resultSet.getResultSetPath(new FsPath(filePath), fileName)
- val resultSetWriter = ResultSetWriter.getResultSetWriter(resultSet, ENGINE_RESULT_SET_MAX_CACHE.getValue.toLong, resultSetPath)
+ //update by peaceWong 20200402
+ val resultSetWriter = resultSet match {
+ case result: TableResultSet =>
+ val contextIDStr = ContextServiceUtils.getContextIDStrByMap(getProperties)
+ val nodeName = ContextServiceUtils.getNodeNameStrByMap(getProperties)
+ if (StringUtils.isNotBlank(contextIDStr) && StringUtils.isNotBlank(nodeName)) {
+ new CSTableResultSetWriter(result, ENGINE_RESULT_SET_MAX_CACHE.getValue.toLong, resultSetPath, contextIDStr, nodeName, alias)
+ } else {
+ ResultSetWriter.getResultSetWriter(resultSet, ENGINE_RESULT_SET_MAX_CACHE.getValue.toLong, resultSetPath)
+ }
+ case _ => ResultSetWriter.getResultSetWriter(resultSet, ENGINE_RESULT_SET_MAX_CACHE.getValue.toLong, resultSetPath)
+ }
+ //update by peaceWong 20200402 end
resultSetWriters synchronized resultSetWriters += resultSetWriter
resultSetWriter
}
- def appendStdout(log: String): Unit = if(!engineExecutor.isEngineInitialized)
+ def appendStdout(log: String): Unit = if (!engineExecutor.isEngineInitialized)
engineExecutor.info(log) else engineExecutor.getLogListener.foreach(ll => jobId.foreach(ll.onLogUpdate(_, log)))
+ def sendProgress(progress: Float, progressInfos: Array[JobProgressInfo]): Unit = {
+ if (engineExecutor.isEngineInitialized) {
+ engineExecutor.getJobProgressListener.foreach(ll => jobId.foreach(ll.onProgressUpdate(_, progress, progressInfos)))
+ }
+ }
+
def close(): Unit = {
resultSetWriters.toArray.foreach(sendResultSet)
engineExecutor.getResultSetListener.foreach(l => jobId.foreach(l.onResultSizeCreated(_, resultSize)))
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorManager.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorManager.scala
index 38712a497b..6dac410e85 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorManager.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineExecutorManager.scala
@@ -58,11 +58,12 @@ abstract class EngineExecutorManager extends ExecutorManager with Logging {
if(executor == null) synchronized {
if(executor == null) {
var options: JMap[String, String] = DWCArgumentsParser.getDWCOptionMap
+ //TODO getUDF peaceWong
getEngineHooks.foreach(hook => options = hook.beforeCreateEngine(options))
executor = getOrCreateEngineExecutorFactory().createExecutor(options)
+ executor.setCodeParser(getOrCreateCodeParser())
executor.init()
executor.setLogListener(jobLogListener)
- executor.setCodeParser(getOrCreateCodeParser())
executor.setResultSetListener(resultSetListener)
//TODO Consider adding timeout(考虑加上超时时间)
getEngineHooks.foreach(_.afterCreatedEngine(executor))
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineJob.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineJob.scala
index ac093c4ea2..89f1a6f84f 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineJob.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/EngineJob.scala
@@ -16,14 +16,17 @@
package com.webank.wedatasphere.linkis.engine.execute
+import com.webank.wedatasphere.linkis.engine.{PropertiesExecuteRequest, ResourceExecuteRequest}
import com.webank.wedatasphere.linkis.protocol.engine.RequestTask
import com.webank.wedatasphere.linkis.scheduler.executer.{ErrorExecuteResponse, ExecuteRequest, JobExecuteRequest, RunTypeExecuteRequest}
import com.webank.wedatasphere.linkis.scheduler.queue.{Job, JobInfo}
-
+import java.util
/**
* Created by enjoyyin on 2018/9/25.
*/
-abstract class EngineJob extends Job with SenderContainer
+abstract class EngineJob extends Job with SenderContainer{
+ val resourcesStr:String = "resources"
+}
class CommonEngineJob extends EngineJob with SyncSenderContainer {
protected var request: RequestTask = _
@@ -36,13 +39,24 @@ class CommonEngineJob extends EngineJob with SyncSenderContainer {
override def isJobSupportRetry: Boolean = false
override protected def jobToExecuteRequest: ExecuteRequest = {
+
if (request.getProperties.containsKey("runType") && request.getProperties.containsKey(RequestTask.RESULT_SET_STORE_PATH))
- return new ExecuteRequest with JobExecuteRequest with StorePathExecuteRequest with RunTypeExecuteRequest{
+ return new ExecuteRequest with JobExecuteRequest with StorePathExecuteRequest
+ with RunTypeExecuteRequest with ResourceExecuteRequest with PropertiesExecuteRequest {
override val code: String = request.getCode
override val jobId: String = CommonEngineJob.this.getId
override val storePath: String = request.getProperties.get(RequestTask.RESULT_SET_STORE_PATH).toString
- override val runType: String = request.getProperties.get("runType").toString
+ override val runType: String = if (request.getProperties.get("runType") != null) {
+ request.getProperties.get("runType").toString
+ } else "sql"
+ override def resources: util.List[Object] = properties.get(resourcesStr) match {
+ case rs:util.List[Object] => rs
+ case _ => logger.warn(s"${CommonEngineJob.this.getId} resources type is not correct")
+ null
+ }
+ override val properties: util.Map[String, Object] = request.getProperties
}
+
if(request.getProperties.containsKey(RequestTask.RESULT_SET_STORE_PATH)) new ExecuteRequest with JobExecuteRequest with StorePathExecuteRequest {
override val code: String = request.getCode
override val jobId: String = CommonEngineJob.this.getId
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/CodeGeneratorEngineHook.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/CodeGeneratorEngineHook.scala
index 974627565e..9af88a8caf 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/CodeGeneratorEngineHook.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/CodeGeneratorEngineHook.scala
@@ -20,7 +20,6 @@ import java.io.File
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineHook}
-import com.webank.wedatasphere.linkis.protocol.engine.RequestEngine
import com.webank.wedatasphere.linkis.scheduler.executer.{ExecuteRequest, RunTypeExecuteRequest}
import com.webank.wedatasphere.linkis.server.JMap
import org.apache.commons.io.FileUtils
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/ReleaseEngineHook.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/ReleaseEngineHook.scala
index 6b4cfa79e8..10fb13ae7d 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/ReleaseEngineHook.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/ReleaseEngineHook.scala
@@ -18,13 +18,12 @@ package com.webank.wedatasphere.linkis.engine.execute.hook
import java.util.concurrent.TimeUnit
-import com.webank.wedatasphere.linkis.common.utils.{ByteTimeUtils, Logging, Utils}
+import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration
import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineHook}
import com.webank.wedatasphere.linkis.protocol.engine.EngineState.Idle
import com.webank.wedatasphere.linkis.scheduler.executer.ExecutorState
import com.webank.wedatasphere.linkis.server.JMap
-import org.apache.commons.lang.StringUtils
/**
* Created by enjoyyin on 2018/9/27.
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/UdfLoadEngineHook.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/UdfLoadEngineHook.scala
index 4a1d2d24c3..2af1999d55 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/UdfLoadEngineHook.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/execute/hook/UdfLoadEngineHook.scala
@@ -21,7 +21,6 @@ import java.io.File
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.conf.EngineConfiguration._
import com.webank.wedatasphere.linkis.engine.execute.{EngineExecutor, EngineHook}
-import com.webank.wedatasphere.linkis.protocol.engine.RequestEngine
import com.webank.wedatasphere.linkis.rpc.Sender
import com.webank.wedatasphere.linkis.scheduler.executer.{ExecuteRequest, RunTypeExecuteRequest}
import com.webank.wedatasphere.linkis.server.JMap
@@ -30,10 +29,9 @@ import com.webank.wedatasphere.linkis.udf.entity.{UDFInfo, UDFTree}
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.io.FileUtils
import org.apache.commons.lang.StringUtils
-import org.codehaus.jackson.map.ObjectMapper
-import scala.collection.mutable
import scala.collection.JavaConversions._
+import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
abstract class UdfLoadEngineHook extends EngineHook with Logging{ self =>
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/extension/EnginePreExecuteHook.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/extension/EnginePreExecuteHook.scala
index 1bbbfcbd34..ae656051b2 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/extension/EnginePreExecuteHook.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/extension/EnginePreExecuteHook.scala
@@ -9,5 +9,5 @@ import com.webank.wedatasphere.linkis.scheduler.executer.ExecuteRequest
*/
trait EnginePreExecuteHook {
val hookName:String
- def callPreExecuteHook(engineExecutorContext:EngineExecutorContext, executeRequest: ExecuteRequest)
+ def callPreExecuteHook(engineExecutorContext:EngineExecutorContext, executeRequest: ExecuteRequest, code: String): String
}
\ No newline at end of file
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManager.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManager.scala
index 8eba4156a4..9550c4208f 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManager.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManager.scala
@@ -16,16 +16,12 @@
package com.webank.wedatasphere.linkis.engine.lock
-import java.util.concurrent.{ConcurrentHashMap, ScheduledThreadPoolExecutor, TimeUnit}
-
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.engine.LockManager
import com.webank.wedatasphere.linkis.engine.execute.EngineExecutorManager
import com.webank.wedatasphere.linkis.scheduler.SchedulerContext
import com.webank.wedatasphere.linkis.scheduler.executer.ExecutorState
-import scala.collection.JavaConversions._
-
class EngineTimedLockManager(schedulerContext: SchedulerContext) extends LockManager(schedulerContext) with Logging{
var executorLock: EngineTimedLock = null
diff --git a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/log/LogHelper.scala b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/log/LogHelper.scala
index a4eae5a857..5ba7c13329 100644
--- a/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/log/LogHelper.scala
+++ b/ujes/engine/src/main/scala/com/webank/wedatasphere/linkis/engine/log/LogHelper.scala
@@ -36,7 +36,7 @@ object LogHelper {
def setLogListener(logListener: LogListener):Unit = this.logListener = logListener
def pushAllRemainLogs():Unit = {
- logger.info(s"start to push all remain logs, and size is ${logCache.getRemain.size()}")
+ logger.info(s"start to push all remain logs")
Thread.sleep(30)
//logCache.synchronized{
if (logListener == null){
diff --git a/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/execute/SparkCombinedCodeParserTest.scala b/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/execute/SparkCombinedCodeParserTest.scala
index 1c838389e6..4ce6c62d7e 100644
--- a/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/execute/SparkCombinedCodeParserTest.scala
+++ b/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/execute/SparkCombinedCodeParserTest.scala
@@ -16,11 +16,6 @@
package com.webank.wedatasphere.linkis.engine.execute
-import java.io.File
-
-import com.google.common.io.Resources
-import org.apache.commons.io.FileUtils
-
//object SparkCombinedCodeParserTest {
// def main(args: Array[String]): Unit = {
// val parser = new SparkCombinedCodeParser
diff --git a/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManagerTest.scala b/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManagerTest.scala
index 5c5e371f52..893b5d497b 100644
--- a/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManagerTest.scala
+++ b/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/lock/EngineTimedLockManagerTest.scala
@@ -17,7 +17,6 @@
package com.webank.wedatasphere.linkis.engine.lock
import com.webank.wedatasphere.linkis.common.listener.ListenerEventBus
-import com.webank.wedatasphere.linkis.engine.lock.EngineTimedLockManagerTest.lockManager
import com.webank.wedatasphere.linkis.scheduler.SchedulerContext
import com.webank.wedatasphere.linkis.scheduler.event.{ScheduleEvent, SchedulerEventListener}
import com.webank.wedatasphere.linkis.scheduler.executer.ExecutorState.ExecutorState
diff --git a/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/log/ScalaLoggingTest.scala b/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/log/ScalaLoggingTest.scala
index 31a051c7a9..d050ad715f 100644
--- a/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/log/ScalaLoggingTest.scala
+++ b/ujes/engine/src/main/test/scala/com/webank/wedatasphere/linkis/engine/log/ScalaLoggingTest.scala
@@ -16,7 +16,6 @@
package scala.com.webank.wedatasphere.linkis.engine.log
-import com.webank.wedatasphere.linkis.common.utils.Logging
import org.slf4j.{Logger, LoggerFactory}
/**
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineCreator.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineCreator.scala
index 15af33f400..fe8fca53ff 100644
--- a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineCreator.scala
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineCreator.scala
@@ -22,7 +22,7 @@ import com.webank.wedatasphere.linkis.common.conf.DWCArgumentsParser
import com.webank.wedatasphere.linkis.common.utils.Utils
import com.webank.wedatasphere.linkis.enginemanager.conf.EngineManagerConfiguration
import com.webank.wedatasphere.linkis.enginemanager.exception.EngineManagerErrorException
-import com.webank.wedatasphere.linkis.enginemanager.impl.{UserEngineResource, UserTimeoutEngineResource}
+import com.webank.wedatasphere.linkis.enginemanager.impl.UserTimeoutEngineResource
import com.webank.wedatasphere.linkis.enginemanager.process.{CommonProcessEngine, ProcessEngine, ProcessEngineBuilder}
import com.webank.wedatasphere.linkis.protocol.engine.{EngineCallback, RequestEngine}
import com.webank.wedatasphere.linkis.rpc.Sender
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineManager.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineManager.scala
index cc6a2b07e4..df2242f6bc 100644
--- a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineManager.scala
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/AbstractEngineManager.scala
@@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit
import com.webank.wedatasphere.linkis.common.log.LogUtils
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
import com.webank.wedatasphere.linkis.enginemanager.conf.EngineManagerConfiguration
-import com.webank.wedatasphere.linkis.enginemanager.exception.{EngineManagerErrorException, EngineManagerWarnException}
+import com.webank.wedatasphere.linkis.enginemanager.exception.{EMRetryException, EngineManagerErrorException, EngineManagerWarnException}
import com.webank.wedatasphere.linkis.protocol.engine.RequestEngine
import com.webank.wedatasphere.linkis.resourcemanager.{AvailableResource, NotEnoughResource, Resource}
@@ -49,7 +49,7 @@ abstract class AbstractEngineManager extends EngineManager with Logging {
val resource = Utils.tryThrow(getEngineManagerContext.getOrCreateEngineResourceFactory
.createEngineResource(realRequest)){t =>
warn(s"In the configuration of ${realRequest.creator}, there is a parameter configuration in the wrong format!(${realRequest.creator}的配置中,存在错误格式的参数配置!)", t)
- throw new EngineManagerErrorException(30000, s"In the configuration of ${realRequest.creator}, there is a parameter configuration in the wrong format!(${realRequest.creator}的配置中,存在错误格式的参数配置!)")
+ throw new EngineManagerErrorException(11011, s"In the configuration of ${realRequest.creator}, there is a parameter configuration in the wrong format!(${realRequest.creator}的配置中,存在错误格式的参数配置!)")
}
val nodeResourceInfo = this.registerResources()
val usedResource = getEngineManagerContext.getOrCreateEngineFactory.getUsedResources.getOrElse(Resource.getZeroResource(resource.getResource))
@@ -59,7 +59,7 @@ abstract class AbstractEngineManager extends EngineManager with Logging {
info("ProtectedResource: "+ nodeResourceInfo.protectedResource.toString)
info("UsedResource: "+ usedResource.toString)
info("RequestResource: "+ resource.getResource.toString)
- throw new EngineManagerErrorException(31000, "The remote server resource has been used up, please switch to the remote server and try again!(远程服务器资源已被用光,请切换远程服务器再试!)")
+ throw new EngineManagerWarnException(31000, "远程服务器资源已被用光,请切换远程服务器再试!")
}
getEngineManagerContext.getOrCreateResourceRequester.request(resource) match {
case NotEnoughResource(reason) =>
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/conf/EnvConfiguration.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/conf/EnvConfiguration.scala
index e01d27d370..2c16639b8f 100644
--- a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/conf/EnvConfiguration.scala
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/conf/EnvConfiguration.scala
@@ -17,7 +17,7 @@
package com.webank.wedatasphere.linkis.enginemanager.conf
import com.webank.wedatasphere.linkis.common.conf.{ByteType, CommonVars}
-import EngineManagerConfiguration.ENGINE_SPRING_APPLICATION_NAME
+import com.webank.wedatasphere.linkis.enginemanager.conf.EngineManagerConfiguration.ENGINE_SPRING_APPLICATION_NAME
import org.apache.commons.lang.time.DateFormatUtils
/**
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/exception/EMRetryException.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/exception/EMRetryException.scala
new file mode 100644
index 0000000000..ad30b466da
--- /dev/null
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/exception/EMRetryException.scala
@@ -0,0 +1,10 @@
+package com.webank.wedatasphere.linkis.enginemanager.exception
+
+import com.webank.wedatasphere.linkis.common.exception.DWCRetryException
+
+/**
+ * created by cooperyang on 2019/12/11
+ * Description:
+ */
+class EMRetryException (errCode:Int, desc:String ) extends DWCRetryException(errCode,desc){
+}
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hook/JarLoaderEngineHook.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hook/JarLoaderEngineHook.scala
index c09e944244..e65c20473e 100644
--- a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hook/JarLoaderEngineHook.scala
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/hook/JarLoaderEngineHook.scala
@@ -56,12 +56,13 @@ class JarLoaderEngineHook extends EngineHook with Logging{
}
protected def isJarExists(udfInfo: UDFInfo) : Boolean = {
- if(FileUtils.getFile(udfInfo.getPath).exists()){
- true
- } else {
- info(s"The jar file [${udfInfo.getPath}] of UDF [${udfInfo.getUdfName}] doesn't exist, ignore it.")
- false
- }
+ true
+// if(FileUtils.getFile(udfInfo.getPath).exists()){
+// true
+// } else {
+// info(s"The jar file [${udfInfo.getPath}] of UDF [${udfInfo.getUdfName}] doesn't exist, ignore it.")
+// false
+// }
}
protected def extractUdfInfos(requestEngine: RequestEngine): mutable.ArrayBuffer[UDFInfo] = {
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerImpl.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerImpl.scala
index f751550920..799203a73a 100644
--- a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerImpl.scala
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerImpl.scala
@@ -16,7 +16,7 @@
package com.webank.wedatasphere.linkis.enginemanager.impl
-import com.webank.wedatasphere.linkis.enginemanager.{AbstractEngineManager, Engine, EngineManagerContext}
+import com.webank.wedatasphere.linkis.enginemanager.{AbstractEngineManager, EngineManagerContext}
import com.webank.wedatasphere.linkis.resourcemanager.domain.ModuleInfo
import com.webank.wedatasphere.linkis.resourcemanager.service.annotation.{EnableResourceManager, RegisterResource}
import org.springframework.beans.factory.annotation.Autowired
diff --git a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerSpringConfiguration.scala b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerSpringConfiguration.scala
index 583fcc488f..599c221187 100644
--- a/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerSpringConfiguration.scala
+++ b/ujes/enginemanager/src/main/scala/com/webank/wedatasphere/linkis/enginemanager/impl/EngineManagerSpringConfiguration.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.enginemanager.impl
-import com.webank.wedatasphere.linkis.common.utils.ByteTimeUtils
import com.webank.wedatasphere.linkis.enginemanager._
import com.webank.wedatasphere.linkis.enginemanager.conf.EngineManagerConfiguration.ENGINE_SPRING_APPLICATION_NAME
import com.webank.wedatasphere.linkis.enginemanager.conf.EnvConfiguration._
diff --git a/ujes/entrance/pom.xml b/ujes/entrance/pom.xml
index 90294dcacb..596fe5123b 100644
--- a/ujes/entrance/pom.xml
+++ b/ujes/entrance/pom.xml
@@ -53,6 +53,19 @@
provided
+
+ com.webank.wedatasphere.linkis
+ linkis-cs-ujes-client
+ ${linkis.version}
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ ${httpclient.version}
+ provided
+
+
junit
junit
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/annotation/EntranceExecutorManagerBeanAnnotation.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/annotation/EntranceExecutorManagerBeanAnnotation.java
index 2cbe6561f7..902733be5f 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/annotation/EntranceExecutorManagerBeanAnnotation.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/annotation/EntranceExecutorManagerBeanAnnotation.java
@@ -22,7 +22,10 @@
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Created by enjoyyin on 2019/2/14.
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/EntranceSpringConfiguration.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/EntranceSpringConfiguration.java
index 62445f5ea1..360e8ffa1f 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/EntranceSpringConfiguration.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/conf/EntranceSpringConfiguration.java
@@ -90,18 +90,24 @@ public PersistenceManager generatePersistenceManager(@PersistenceEngineBeanAnnot
@EntranceListenerBusBeanAnnotation
@ConditionalOnMissingBean(name = {EntranceListenerBusBeanAnnotation.BEAN_NAME})
- public EntranceEventListenerBus generateEntranceEventListenerBus(){
+ public EntranceEventListenerBus generateEntranceEventListenerBus() {
EntranceEventListenerBus entranceEventListenerBus = new EntranceEventListenerBus();
entranceEventListenerBus.start();
return entranceEventListenerBus;
}
+ /**
+ * Update by peaceWong add CSEntranceInterceptor
+ *
+ * @return
+ */
@EntranceInterceptorBeanAnnotation
@ConditionalOnMissingBean(name = {EntranceInterceptorBeanAnnotation.BEAN_NAME})
public EntranceInterceptor[] generateEntranceInterceptors() {
- return new EntranceInterceptor[] {new PythonCodeCheckInterceptor(), new DBInfoCompleteInterceptor(), new SparkCodeCheckInterceptor(),
+ return new EntranceInterceptor[]{new CSEntranceInterceptor(), new PythonCodeCheckInterceptor(), new DBInfoCompleteInterceptor(), new SparkCodeCheckInterceptor(),
new SQLCodeCheckInterceptor(), new VarSubstitutionInterceptor(), new LogPathCreateInterceptor(),
- new StorePathEntranceInterceptor(), new ScalaCodeInterceptor(), new SQLLimitEntranceInterceptor(),new CommentInterceptor()};
+ new StorePathEntranceInterceptor(), new ScalaCodeInterceptor(), new SQLLimitEntranceInterceptor(), new CommentInterceptor(),
+ };
}
@ErrorCodeListenerBeanAnnotation
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/exception/EntranceIllegalParamException.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/exception/EntranceIllegalParamException.java
index a66d74f952..82da5b66b5 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/exception/EntranceIllegalParamException.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/exception/EntranceIllegalParamException.java
@@ -16,9 +16,7 @@
package com.webank.wedatasphere.linkis.entrance.exception;
-import com.webank.wedatasphere.linkis.common.exception.DWCRuntimeException;
import com.webank.wedatasphere.linkis.common.exception.ErrorException;
-import com.webank.wedatasphere.linkis.common.exception.ExceptionLevel;
/**
* created by enjoyyin on 2018/10/8
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/job/EntranceExecutionJob.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/job/EntranceExecutionJob.java
index 2d600b0c5e..1f5585b500 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/job/EntranceExecutionJob.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/job/EntranceExecutionJob.java
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.entrance.job;
-import com.webank.wedatasphere.linkis.common.conf.TimeType;
import com.webank.wedatasphere.linkis.common.log.LogUtils;
import com.webank.wedatasphere.linkis.common.utils.Utils;
import com.webank.wedatasphere.linkis.entrance.execute.*;
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/parser/AbstractEntranceParser.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/parser/AbstractEntranceParser.java
index 634a48af0b..8910c70fb2 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/parser/AbstractEntranceParser.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/parser/AbstractEntranceParser.java
@@ -107,6 +107,7 @@ public Job parseToJob(Task task) throws EntranceIllegalParamException {
//job.setProgressListener(entranceContext.getOrCreatePersistenceManager());
//job.setJobListener(entranceContext.getOrCreatePersistenceManager());
job.setEntranceListenerBus(entranceContext.getOrCreateEventListenerBus());
+ job.setEntranceContext(entranceContext);
job.setListenerEventBus(null);
job.setProgress(0f);
}
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceEngine.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceEngine.java
index 7088234ee9..67daab244a 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceEngine.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceEngine.java
@@ -23,6 +23,7 @@
package com.webank.wedatasphere.linkis.entrance.persistence;
import com.google.gson.Gson;
+import com.webank.wedatasphere.linkis.entrance.conf.EntranceConfiguration;
import com.webank.wedatasphere.linkis.entrance.conf.EntranceConfiguration$;
import com.webank.wedatasphere.linkis.entrance.exception.EntranceIllegalParamException;
import com.webank.wedatasphere.linkis.entrance.exception.EntranceRPCException;
@@ -82,10 +83,6 @@ public void persist(Task task) throws QueryFailedException, EntranceIllegalParam
if (object == null){
throw new QueryFailedException(20011, "insert task failed, reason: " + message);
}
-/* if (object instanceof Long){
- Long taskID = (Long)object;
- ((RequestPersistTask) task).setTaskID(taskID);
- }*/
String taskStr = object.toString();
Long taskID = Long.parseLong(taskStr.substring(0,taskStr.indexOf(".")));
((RequestPersistTask) task).setTaskID(taskID);
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceManager.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceManager.java
index 9a89ff86d3..27edd6acb5 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceManager.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/persistence/QueryPersistenceManager.java
@@ -25,6 +25,7 @@
import com.webank.wedatasphere.linkis.common.exception.ErrorException;
import com.webank.wedatasphere.linkis.common.io.FsPath;
import com.webank.wedatasphere.linkis.entrance.EntranceContext;
+import com.webank.wedatasphere.linkis.entrance.cs.CSEntranceHelper;
import com.webank.wedatasphere.linkis.entrance.execute.EntranceJob;
import com.webank.wedatasphere.linkis.protocol.engine.JobProgressInfo;
import com.webank.wedatasphere.linkis.protocol.query.RequestPersistTask;
@@ -79,7 +80,6 @@ public ResultSetEngine createResultSetEngine() {
public void onResultSetCreated(Job job, OutputExecuteResponse response) {
String path;
boolean isEntranceJob = job instanceof EntranceJob;
-// if(isEntranceJob) ((EntranceJob)job).incrementResultSetPersist();
try {
path = createResultSetEngine().persistResultSet(job, response);
} catch (Throwable e) {
@@ -98,14 +98,18 @@ public void onResultSetCreated(Job job, OutputExecuteResponse response) {
} catch (Throwable e1){
logger.error("job {} onLogUpdate error, reason:", job.getId(), e1);
} //ignore it
- if(isEntranceJob) ((EntranceJob)job).incrementResultSetPersisted();
+ if(isEntranceJob) {
+ ((EntranceJob)job).incrementResultSetPersisted();
+ }
return;
}
if(task instanceof RequestPersistTask) {
RequestPersistTask requestPersistTask = (RequestPersistTask) task;
if(StringUtils.isEmpty(requestPersistTask.getResultLocation())) synchronized (task) {
if(StringUtils.isNotEmpty(requestPersistTask.getResultLocation())) {
- if(isEntranceJob) ((EntranceJob)job).incrementResultSetPersisted();
+ if(isEntranceJob) {
+ ((EntranceJob)job).incrementResultSetPersisted();
+ }
return;
}
try {
@@ -117,7 +121,9 @@ public void onResultSetCreated(Job job, OutputExecuteResponse response) {
}
}
}
- if(isEntranceJob) ((EntranceJob)job).incrementResultSetPersisted();
+ if(isEntranceJob) {
+ ((EntranceJob)job).incrementResultSetPersisted();
+ }
}
@Override
@@ -153,6 +159,15 @@ public void onJobWaitForRetry(Job job) {
@Override
public void onJobCompleted(Job job) {
+ //update by peaceWong(2020/05/10) to set jobID to CS
+ try {
+ if (job.isSucceed()) {
+ CSEntranceHelper.registerCSRSData(job);
+ }
+ } catch (Throwable e) {
+ logger.error("Failed to register cs rs data ", e);
+ }
+ //end update
updateJobStatus(job);
}
@@ -163,12 +178,15 @@ private void updateJobStatus(Job job){
}
try{
task = this.entranceContext.getOrCreateEntranceParser().parseToTask(job);
+ if (job.isSucceed()){
+ //如果是job是成功的,那么需要将task的错误描述等都要设置为null
+ ((RequestPersistTask)task).setErrCode(null);
+ ((RequestPersistTask)task).setErrDesc(null);
+ }
}catch(ErrorException e){
entranceContext.getOrCreateLogManager().onLogUpdate(job, e.getMessage());
logger.error("update job status failed, reason:", e);
}
- //TODO If the execution fails, there may be an error message, you need to call job.getErrorResponse to persist the error message.(如果是执行失败了,可能会有错误信息,需要调用job.getErrorResponse持久化错误信息)
- //TODO The error message is compared with the error code of errorListener(错误信息要跟errorListener的错误码信息对比)
try {
createPersistenceEngine().updateIfNeeded(task);
} catch (ErrorException e) {
diff --git a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/restful/EntranceRestfulApi.java b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/restful/EntranceRestfulApi.java
index 2a23bb542d..44238f8f42 100644
--- a/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/restful/EntranceRestfulApi.java
+++ b/ujes/entrance/src/main/java/com/webank/wedatasphere/linkis/entrance/restful/EntranceRestfulApi.java
@@ -20,9 +20,9 @@
import com.webank.wedatasphere.linkis.entrance.EntranceServer;
import com.webank.wedatasphere.linkis.entrance.annotation.EntranceServerBeanAnnotation;
import com.webank.wedatasphere.linkis.entrance.background.BackGroundService;
-import com.webank.wedatasphere.linkis.entrance.conf.EntranceConfiguration;
import com.webank.wedatasphere.linkis.entrance.execute.EntranceJob;
import com.webank.wedatasphere.linkis.entrance.log.LogReader;
+import com.webank.wedatasphere.linkis.entrance.utils.JobHistoryHelper;
import com.webank.wedatasphere.linkis.protocol.constants.TaskConstant;
import com.webank.wedatasphere.linkis.protocol.engine.JobProgressInfo;
import com.webank.wedatasphere.linkis.protocol.query.RequestPersistTask;
@@ -37,9 +37,7 @@
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.RequestParam;
import scala.Option;
import javax.servlet.http.HttpServletRequest;
@@ -113,10 +111,22 @@ private void pushLog(String log, Job job){
@Override
@GET
@Path("/{id}/status")
- public Response status(@PathParam("id") String id) {
+ public Response status(@PathParam("id") String id, @QueryParam("taskID")String taskID) {
Message message = null;
String realId = ZuulEntranceUtils.parseExecID(id)[3];
- Option job = entranceServer.getJob(realId);
+ Option job = Option.apply(null);
+ try{
+ job = entranceServer.getJob(realId);
+ }catch(Exception e){
+ logger.warn("获取任务 {} 状态时出现错误", realId, e);
+ //如果获取错误了,证明在内存中已经没有了,去jobhistory找寻一下taskID代表的任务的状态,然后返回
+ long realTaskID = Long.parseLong(taskID);
+ String status = JobHistoryHelper.getStatusByTaskID(realTaskID);
+ message = Message.ok();
+ message.setMethod("/api/entrance/" + id + "/status");
+ message.data("status",status).data("execID", id);
+ return Message.messageToResponse(message);
+ }
if (job.isDefined()){
message = Message.ok();
message.setMethod("/api/entrance/" + id + "/status");
@@ -139,20 +149,20 @@ public Response progress(@PathParam("id")String id) {
Option job = entranceServer.getJob(realId);
if (job.isDefined()){
JobProgressInfo[] jobProgressInfos = ((EntranceJob)job.get()).getProgressInfo();
- Map map = new HashMap<>();
if (jobProgressInfos == null){
message = Message.error("Can not get the corresponding progress information, it may be that the corresponding progress information has not been generated(不能获取相应的进度信息,可能是相应的进度信息还未生成)");
message.setMethod("/api/entrance/" + id + "/progress");
}else{
- for(JobProgressInfo jobProgressInfo : jobProgressInfos){
+ List
+
+ com.webank.wedatasphere.linkis
+ linkis-cloudRPC
+ ${linkis.version}
+ provided
+
diff --git a/ujes/jdbc/pom.xml b/ujes/jdbc/pom.xml
index ebbdfee216..80d779088e 100644
--- a/ujes/jdbc/pom.xml
+++ b/ujes/jdbc/pom.xml
@@ -1,5 +1,18 @@
+
+
@@ -15,7 +28,7 @@
com.webank.wedatasphere.linkis
linkis-ujes-client
- 0.9.4
+ ${linkis.version}
From 75c56f159e21dc11de67f3ffb8bfd540a43e42e2 Mon Sep 17 00:00:00 2001
From: yangzhiyue <904666286@qq.com>
Date: Wed, 3 Jun 2020 22:46:22 +0800
Subject: [PATCH 8/8] adjust gateway module
---
.../cs/listener/test/TestListenerManager.java | 1 -
.../config/GatewaySpringConfiguration.scala | 2 +-
.../linkis/gateway/http/GatewayContext.scala | 9 ++
.../gateway/security/GatewaySSOUtils.scala | 2 +-
.../linkis/gateway/security/UserRestful.scala | 4 +-
gateway/gateway-httpclient-support/pom.xml | 2 +-
.../linkis/httpclient/dws/DWSHttpClient.scala | 21 +--
.../StaticAuthenticationStrategy.scala | 4 +-
.../TokenAuthenticationStrategy.scala | 7 +-
.../dws/config/DWSClientConfigBuilder.scala | 2 +-
.../dws/discovery/DWSGatewayDiscovery.scala | 4 +-
.../response/DWSAuthenticationResult.scala | 32 +++--
.../dws/response/DWSHeartbeatResult.scala | 25 +++-
gateway/gateway-ujes-support/pom.xml | 6 +
.../parser/EntranceRequestGatewayParser.scala | 3 +-
.../ujes/route/HaContextGatewayRouter.scala | 124 ++++++++++++++++++
.../contextservice/ContextIdParserImpl.scala | 52 ++++++++
.../SpringCloudGatewayConfiguration.scala | 1 -
18 files changed, 263 insertions(+), 38 deletions(-)
create mode 100644 gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/HaContextGatewayRouter.scala
create mode 100644 gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/contextservice/ContextIdParserImpl.scala
diff --git a/contextservice/cs-listener/src/test/java/com/webank/wedatasphere/linkis/cs/listener/test/TestListenerManager.java b/contextservice/cs-listener/src/test/java/com/webank/wedatasphere/linkis/cs/listener/test/TestListenerManager.java
index 3835c672d8..c86d8a4c85 100644
--- a/contextservice/cs-listener/src/test/java/com/webank/wedatasphere/linkis/cs/listener/test/TestListenerManager.java
+++ b/contextservice/cs-listener/src/test/java/com/webank/wedatasphere/linkis/cs/listener/test/TestListenerManager.java
@@ -7,7 +7,6 @@
import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextKeyValue;
import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextValue;
import com.webank.wedatasphere.linkis.cs.listener.ListenerBus.ContextAsyncListenerBus;
-import com.webank.wedatasphere.linkis.cs.listener.callback.imp.ClientSource;
import com.webank.wedatasphere.linkis.cs.listener.callback.imp.ContextKeyValueBean;
import com.webank.wedatasphere.linkis.cs.listener.callback.imp.DefaultContextIDCallbackEngine;
import com.webank.wedatasphere.linkis.cs.listener.callback.imp.DefaultContextKeyCallbackEngine;
diff --git a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/config/GatewaySpringConfiguration.scala b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/config/GatewaySpringConfiguration.scala
index 67eab5ff64..f8ef9a71e9 100644
--- a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/config/GatewaySpringConfiguration.scala
+++ b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/config/GatewaySpringConfiguration.scala
@@ -16,7 +16,7 @@
package com.webank.wedatasphere.linkis.gateway.config
-import com.webank.wedatasphere.linkis.gateway.security.{LDAPUserRestful, SecurityHook, SecurityFilter, UserRestful}
+import com.webank.wedatasphere.linkis.gateway.security.{LDAPUserRestful, SecurityFilter, SecurityHook, UserRestful}
import javax.annotation.PostConstruct
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
diff --git a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/http/GatewayContext.scala b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/http/GatewayContext.scala
index 87906ee5ee..092ece9e1e 100644
--- a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/http/GatewayContext.scala
+++ b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/http/GatewayContext.scala
@@ -16,6 +16,10 @@
package com.webank.wedatasphere.linkis.gateway.http
+import java.util
+
+import com.webank.wedatasphere.linkis.server.JMap
+
/**
* created by cooperyang on 2019/1/9.
*/
@@ -32,6 +36,7 @@ trait GatewayContext {
def setGatewayRoute(gatewayRoute: GatewayRoute): Unit
def getGatewayRoute: GatewayRoute
+ def getParams: JMap[String, String]
}
class BaseGatewayContext extends GatewayContext {
private var request: GatewayHttpRequest = _
@@ -39,6 +44,8 @@ class BaseGatewayContext extends GatewayContext {
private var webSocketRequest: Boolean = false
private var gatewayRoute: GatewayRoute = _
+ private val props: JMap[String, String] = new util.HashMap[String, String]()
+
override def getRequest: GatewayHttpRequest = request
override def setRequest(request: GatewayHttpRequest): Unit = this.request = request
@@ -54,4 +61,6 @@ class BaseGatewayContext extends GatewayContext {
override def setGatewayRoute(gatewayRoute: GatewayRoute): Unit = this.gatewayRoute = gatewayRoute
override def getGatewayRoute: GatewayRoute = gatewayRoute
+
+ override def getParams: JMap[String, String] = this.props
}
\ No newline at end of file
diff --git a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/GatewaySSOUtils.scala b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/GatewaySSOUtils.scala
index 2d459d5228..08dd795913 100644
--- a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/GatewaySSOUtils.scala
+++ b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/GatewaySSOUtils.scala
@@ -19,8 +19,8 @@ package com.webank.wedatasphere.linkis.gateway.security
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
import com.webank.wedatasphere.linkis.gateway.http.{GatewayContext, GatewayHttpRequest}
import com.webank.wedatasphere.linkis.server.exception.LoginExpireException
-import com.webank.wedatasphere.linkis.server.security.{SSOUtils, ServerSSOUtils}
import com.webank.wedatasphere.linkis.server.security.SecurityFilter._
+import com.webank.wedatasphere.linkis.server.security.{SSOUtils, ServerSSOUtils}
import javax.servlet.http.Cookie
import scala.collection.JavaConversions._
diff --git a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/UserRestful.scala b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/UserRestful.scala
index 8678f531ef..d01b9dbf07 100644
--- a/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/UserRestful.scala
+++ b/gateway/core/src/main/scala/com/webank/wedatasphere/linkis/gateway/security/UserRestful.scala
@@ -16,9 +16,7 @@
package com.webank.wedatasphere.linkis.gateway.security
-import java.util.Random
-
-import com.google.gson.{Gson, JsonObject}
+import com.google.gson.Gson
import com.webank.wedatasphere.linkis.common.utils.{Logging, RSAUtils, Utils}
import com.webank.wedatasphere.linkis.gateway.config.GatewayConfiguration
import com.webank.wedatasphere.linkis.gateway.http.GatewayContext
diff --git a/gateway/gateway-httpclient-support/pom.xml b/gateway/gateway-httpclient-support/pom.xml
index dce31146f9..c0daf49b0e 100644
--- a/gateway/gateway-httpclient-support/pom.xml
+++ b/gateway/gateway-httpclient-support/pom.xml
@@ -42,7 +42,7 @@
commons-beanutils
commons-beanutils
- 1.7.0
+ 1.9.4
org.reflections
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/DWSHttpClient.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/DWSHttpClient.scala
index 6f9c481e4f..d36005c115 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/DWSHttpClient.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/DWSHttpClient.scala
@@ -24,7 +24,6 @@ import java.text.SimpleDateFormat
import java.util
import com.fasterxml.jackson.databind.ObjectMapper
-import com.ning.http.client.Response
import com.webank.wedatasphere.linkis.common.io.{Fs, FsPath}
import com.webank.wedatasphere.linkis.httpclient.AbstractHttpClient
import com.webank.wedatasphere.linkis.httpclient.discovery.Discovery
@@ -37,6 +36,7 @@ import com.webank.wedatasphere.linkis.httpclient.response.{HttpResult, ListResul
import com.webank.wedatasphere.linkis.storage.FSFactory
import org.apache.commons.beanutils.BeanUtils
import org.apache.commons.lang.ClassUtils
+import org.apache.http.HttpResponse
import scala.collection.JavaConversions.mapAsJavaMap
@@ -44,7 +44,7 @@ import scala.collection.JavaConversions.mapAsJavaMap
* created by cooperyang on 2019/5/20.
*/
class DWSHttpClient(clientConfig: DWSClientConfig, clientName: String)
- extends AbstractHttpClient(clientConfig, clientName) {
+ extends AbstractHttpClient(clientConfig, clientName) {
override protected def createDiscovery(): Discovery = new DWSGatewayDiscovery
@@ -57,21 +57,25 @@ class DWSHttpClient(clientConfig: DWSClientConfig, clientName: String)
requestAction
}
- override protected def httpResponseToResult(response: Response, requestAction: HttpAction): Option[Result] = {
- val url = requestAction.getURL
+ override protected def httpResponseToResult(response: HttpResponse, requestAction: HttpAction, responseBody: String): Option[Result] = {
+ var entity = response.getEntity
+ val statusCode: Int = response.getStatusLine.getStatusCode
+ val url: String = requestAction.getURL
+ val contentType: String = entity.getContentType.getValue
DWSHttpMessageFactory.getDWSHttpMessageResult(url).map { case DWSHttpMessageResultInfo(_, clazz) =>
clazz match {
case c if ClassUtils.isAssignable(c, classOf[DWSResult]) =>
val dwsResult = clazz.getConstructor().newInstance().asInstanceOf[DWSResult]
- dwsResult.set(response.getResponseBody, response.getStatusCode, response.getUri.toString, response.getContentType)
+ dwsResult.set(responseBody, statusCode, url, contentType)
BeanUtils.populate(dwsResult, dwsResult.getData)
return Some(dwsResult)
case _ =>
}
+
def transfer(value: Result, map: Map[String, Object]): Unit = {
value match {
case httpResult: HttpResult =>
- httpResult.set(response.getResponseBody, response.getStatusCode, response.getUri.toString, response.getContentType)
+ httpResult.set(responseBody, statusCode, url, contentType)
case _ =>
}
val javaMap = mapAsJavaMap(map)
@@ -89,17 +93,18 @@ class DWSHttpClient(clientConfig: DWSClientConfig, clientName: String)
transfer(value, map)
value
}.toArray
- new ListResult(response.getResponseBody, results)
+ new ListResult(responseBody, results)
}
}.orElse(nonDWSResponseToResult(response, requestAction))
}
- protected def nonDWSResponseToResult(response: Response, requestAction: HttpAction): Option[Result] = None
+ protected def nonDWSResponseToResult(response: HttpResponse, requestAction: HttpAction): Option[Result] = None
protected def fillResultFields(responseMap: util.Map[String, Object], value: Result): Unit = {}
//TODO Consistent with workspace, plus expiration time(与workspace保持一致,加上过期时间)
override protected def getFsByUser(user: String, path: FsPath): Fs = FSFactory.getFsByProxyUser(path, user)
+
}
object DWSHttpClient {
val jacksonJson = new ObjectMapper().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"))
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/StaticAuthenticationStrategy.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/StaticAuthenticationStrategy.scala
index ab967b9558..129a2a0f77 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/StaticAuthenticationStrategy.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/StaticAuthenticationStrategy.scala
@@ -16,7 +16,6 @@
package com.webank.wedatasphere.linkis.httpclient.dws.authentication
-import com.ning.http.client.Response
import com.webank.wedatasphere.linkis.common.utils.ByteTimeUtils
import com.webank.wedatasphere.linkis.httpclient.authentication.{AbstractAuthenticationStrategy, AuthenticationAction, AuthenticationResult}
import com.webank.wedatasphere.linkis.httpclient.dws.exception.AuthenticationFailedException
@@ -24,6 +23,7 @@ import com.webank.wedatasphere.linkis.httpclient.dws.request.DWSAuthenticationAc
import com.webank.wedatasphere.linkis.httpclient.dws.response.DWSAuthenticationResult
import com.webank.wedatasphere.linkis.httpclient.request.{Action, UserAction, UserPwdAction}
import org.apache.commons.lang.StringUtils
+import org.apache.http.HttpResponse
/**
* created by cooperyang on 2019/5/22.
@@ -51,7 +51,7 @@ class StaticAuthenticationStrategy(override protected val sessionMaxAliveTime: L
action
}
- override def getAuthenticationResult(response: Response, requestAction: AuthenticationAction): AuthenticationResult = {
+ override def getAuthenticationResult(response: HttpResponse, requestAction: AuthenticationAction): AuthenticationResult = {
new DWSAuthenticationResult(response, requestAction.serverUrl)
}
}
\ No newline at end of file
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/TokenAuthenticationStrategy.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/TokenAuthenticationStrategy.scala
index ac74199fd0..061bcc27f0 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/TokenAuthenticationStrategy.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/authentication/TokenAuthenticationStrategy.scala
@@ -18,11 +18,11 @@ package com.webank.wedatasphere.linkis.httpclient.dws.authentication
import java.util
-import com.ning.http.client.Response
-import com.ning.http.client.cookie.Cookie
import com.webank.wedatasphere.linkis.httpclient.authentication._
import com.webank.wedatasphere.linkis.httpclient.dws.exception.AuthenticationFailedException
import com.webank.wedatasphere.linkis.httpclient.request.{Action, UserAction}
+import org.apache.http.HttpResponse
+import org.apache.http.cookie.Cookie
/**
* Created by enjoyyin on 2019/10/4.
@@ -35,6 +35,7 @@ class TokenAuthenticationStrategy(override protected val sessionMaxAliveTime: Lo
case _: AuthenticationAction => null
case action: UserAction => new HttpAuthentication {
import TokenAuthenticationStrategy._
+
import scala.collection.JavaConversions._
override def authToCookies: Array[Cookie] = Array.empty
@@ -51,7 +52,7 @@ class TokenAuthenticationStrategy(override protected val sessionMaxAliveTime: Lo
override protected def getAuthenticationAction(requestAction: Action, serverUrl: String): AuthenticationAction = null
- override def getAuthenticationResult(response: Response, requestAction: AuthenticationAction): AuthenticationResult = null
+ override def getAuthenticationResult(response: HttpResponse, requestAction: AuthenticationAction): AuthenticationResult = null
}
object TokenAuthenticationStrategy {
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/config/DWSClientConfigBuilder.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/config/DWSClientConfigBuilder.scala
index 51481c7108..2498b8e522 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/config/DWSClientConfigBuilder.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/config/DWSClientConfigBuilder.scala
@@ -16,7 +16,7 @@
package com.webank.wedatasphere.linkis.httpclient.dws.config
-import com.webank.wedatasphere.linkis.httpclient.config.{ClientConfig, ClientConfigBuilder}
+import com.webank.wedatasphere.linkis.httpclient.config.ClientConfigBuilder
import com.webank.wedatasphere.linkis.httpclient.dws.exception.UnknownVersionException
import org.apache.commons.lang.StringUtils
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/discovery/DWSGatewayDiscovery.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/discovery/DWSGatewayDiscovery.scala
index 2dc2992401..bb77b5beca 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/discovery/DWSGatewayDiscovery.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/discovery/DWSGatewayDiscovery.scala
@@ -20,10 +20,10 @@
package com.webank.wedatasphere.linkis.httpclient.dws.discovery
-import com.ning.http.client.Response
import com.webank.wedatasphere.linkis.httpclient.discovery.{AbstractDiscovery, HeartbeatAction, HeartbeatResult}
import com.webank.wedatasphere.linkis.httpclient.dws.request.DWSHeartbeatAction
import com.webank.wedatasphere.linkis.httpclient.dws.response.DWSHeartbeatResult
+import org.apache.http.HttpResponse
import scala.util.Random
@@ -43,7 +43,7 @@ class DWSGatewayDiscovery extends AbstractDiscovery {
override protected def getHeartbeatAction(serverUrl: String): HeartbeatAction = new DWSHeartbeatAction(serverUrl)
- override def getHeartbeatResult(response: Response, requestAction: HeartbeatAction): HeartbeatResult = requestAction match {
+ override def getHeartbeatResult(response: HttpResponse, requestAction: HeartbeatAction): HeartbeatResult = requestAction match {
case h: DWSHeartbeatAction => new DWSHeartbeatResult(response, h.serverUrl)
}
}
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSAuthenticationResult.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSAuthenticationResult.scala
index de939f884a..bc2c479b0c 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSAuthenticationResult.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSAuthenticationResult.scala
@@ -18,22 +18,37 @@ package com.webank.wedatasphere.linkis.httpclient.dws.response
import java.util
-import com.ning.http.client.Response
-import com.ning.http.client.cookie.Cookie
import com.webank.wedatasphere.linkis.httpclient.authentication.{Authentication, AuthenticationResult, HttpAuthentication}
import com.webank.wedatasphere.linkis.httpclient.exception.HttpMessageParseException
-
-import scala.collection.JavaConversions
+import org.apache.http.HttpResponse
+import org.apache.http.cookie.Cookie
+import org.apache.http.util.EntityUtils
/**
* created by cooperyang on 2019/5/22.
*/
-class DWSAuthenticationResult(response: Response, serverUrl: String) extends AuthenticationResult with DWSResult {
+class DWSAuthenticationResult(response: HttpResponse, serverUrl: String) extends AuthenticationResult with DWSResult {
+
+ setResponse()
+
+ private def setResponse(): Unit = {
+ val entity = response.getEntity
+ val responseBody: String = if (entity != null) {
+ EntityUtils.toString(entity, "UTF-8")
+ } else {
+ null
+ }
+ val statusCode: Int = response.getStatusLine.getStatusCode
+ val url: String = serverUrl
+ val contentType: String = entity.getContentType.getValue
+ set(responseBody, statusCode, url, contentType)
+ }
- set(response.getResponseBody, response.getStatusCode, response.getUri.toString, response.getContentType)
- override def getAuthentication: Authentication = if(getStatus == 0) new HttpAuthentication {
+
+ override def getAuthentication: Authentication = if (getStatus == 0) new HttpAuthentication {
private var lastAccessTime: Long = System.currentTimeMillis
- override def authToCookies: Array[Cookie] = JavaConversions.asScalaBuffer(response.getCookies).toArray
+
+ override def authToCookies: Array[Cookie] = Array.empty
override def authToHeaders: util.Map[String, String] = new util.HashMap[String, String]()
@@ -44,4 +59,5 @@ class DWSAuthenticationResult(response: Response, serverUrl: String) extends Aut
override def updateLastAccessTime(): Unit = lastAccessTime = System.currentTimeMillis
} else throw new HttpMessageParseException(s"login to gateway $serverUrl failed! Reason: " + getMessage)
+
}
diff --git a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSHeartbeatResult.scala b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSHeartbeatResult.scala
index 3697e33cd6..4030a5a05e 100644
--- a/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSHeartbeatResult.scala
+++ b/gateway/gateway-httpclient-support/src/main/scala/com/webank/wedatasphere/linkis/httpclient/dws/response/DWSHeartbeatResult.scala
@@ -18,16 +18,33 @@ package com.webank.wedatasphere.linkis.httpclient.dws.response
import java.util
-import com.ning.http.client.Response
import com.webank.wedatasphere.linkis.httpclient.discovery.HeartbeatResult
+import org.apache.http.HttpResponse
+import org.apache.http.util.EntityUtils
/**
* created by cooperyang on 2019/5/22.
*/
-class DWSHeartbeatResult(response: Response, serverUrl: String) extends HeartbeatResult with DWSResult {
+class DWSHeartbeatResult(response: HttpResponse, serverUrl: String) extends HeartbeatResult with DWSResult {
- set(response.getResponseBody, response.getStatusCode, response.getUri.toString, response.getContentType)
- if(getStatus != 0) warn(s"heartbeat to gateway $serverUrl failed! message: $getMessage.")
+
+ setResponse()
+
+ private def setResponse(): Unit = {
+ val entity = response.getEntity
+ val responseBody: String = if (entity != null) {
+ EntityUtils.toString(entity, "UTF-8")
+ } else {
+ null
+ }
+ val statusCode: Int = response.getStatusLine.getStatusCode
+ val url: String = serverUrl
+ val contentType: String = entity.getContentType.getValue
+ set(responseBody, statusCode, url, contentType)
+ }
+
+
+ if (getStatus != 0) warn(s"heartbeat to gateway $serverUrl failed! message: $getMessage.")
override val isHealthy: Boolean = getData.get("isHealthy") match {
case b: java.lang.Boolean => b
case s if s != null => s.toString.toBoolean
diff --git a/gateway/gateway-ujes-support/pom.xml b/gateway/gateway-ujes-support/pom.xml
index 9a44a17cac..bc041956e6 100644
--- a/gateway/gateway-ujes-support/pom.xml
+++ b/gateway/gateway-ujes-support/pom.xml
@@ -51,6 +51,12 @@
2.1
+
+ com.webank.wedatasphere.linkis
+ linkis-cs-common
+ ${linkis.version}
+
+
diff --git a/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/parser/EntranceRequestGatewayParser.scala b/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/parser/EntranceRequestGatewayParser.scala
index 348934e1c8..4775203889 100644
--- a/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/parser/EntranceRequestGatewayParser.scala
+++ b/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/parser/EntranceRequestGatewayParser.scala
@@ -19,12 +19,11 @@ package com.webank.wedatasphere.linkis.gateway.ujes.parser
import com.webank.wedatasphere.linkis.common.ServiceInstance
import com.webank.wedatasphere.linkis.gateway.http.GatewayContext
import com.webank.wedatasphere.linkis.gateway.parser.AbstractGatewayParser
+import com.webank.wedatasphere.linkis.gateway.ujes.parser.EntranceExecutionGatewayParser._
import com.webank.wedatasphere.linkis.protocol.constants.TaskConstant
import com.webank.wedatasphere.linkis.protocol.utils.ZuulEntranceUtils
import org.springframework.stereotype.Component
-import EntranceExecutionGatewayParser._
-
/**
* created by cooperyang on 2019/5/15.
*/
diff --git a/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/HaContextGatewayRouter.scala b/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/HaContextGatewayRouter.scala
new file mode 100644
index 0000000000..39ddbe9bfa
--- /dev/null
+++ b/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/HaContextGatewayRouter.scala
@@ -0,0 +1,124 @@
+package com.webank.wedatasphere.linkis.gateway.ujes.route
+
+import java.util
+
+import com.webank.wedatasphere.linkis.common.ServiceInstance
+import com.webank.wedatasphere.linkis.cs.common.entity.source.{ContextID, ContextIDParser}
+import com.webank.wedatasphere.linkis.cs.common.protocol.ContextHTTPConstant
+import com.webank.wedatasphere.linkis.cs.common.serialize.helper.ContextSerializationHelper
+import com.webank.wedatasphere.linkis.gateway.http.GatewayContext
+import com.webank.wedatasphere.linkis.gateway.route.AbstractGatewayRouter
+import com.webank.wedatasphere.linkis.gateway.springcloud.SpringCloudGatewayConfiguration.{API_URL_PREFIX, normalPath}
+import com.webank.wedatasphere.linkis.rpc.interceptor.ServiceInstanceUtils
+import org.apache.commons.lang.StringUtils
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Component
+
+import scala.collection.JavaConversions._
+import scala.util.Random
+import scala.util.matching.Regex
+
+/**
+ * created by cooperyang on 2020/2/19
+ * Description:
+ */
+@Component
+class HaContextGatewayRouter extends AbstractGatewayRouter{
+
+ @Autowired
+ private var contextIDParser: ContextIDParser = _
+ private val serializationHelper = ContextSerializationHelper.getInstance();
+
+ override def route(gatewayContext: GatewayContext): ServiceInstance = {
+
+ if (gatewayContext.getGatewayRoute.getRequestURI.contains("contextservice")){
+ val params: util.HashMap[String, String] = gatewayContext.getGatewayRoute.getParams
+ if (!gatewayContext.getRequest.getQueryParams.isEmpty) {
+ for ((k, vArr) <- gatewayContext.getRequest.getQueryParams) {
+ if (vArr.nonEmpty) {
+ params.putIfAbsent(k, vArr.head)
+ }
+ }
+ }
+ if (gatewayContext.getRequest.getHeaders.containsKey(ContextHTTPConstant.CONTEXT_ID_STR)) {
+ params.putIfAbsent(ContextHTTPConstant.CONTEXT_ID_STR, gatewayContext.getRequest.getHeaders.get(ContextHTTPConstant.CONTEXT_ID_STR)(0))
+ }
+ if (null == params || params.isEmpty) {
+ dealContextCreate(gatewayContext)
+ } else {
+ var contextId : String = null
+ for ((key, value) <- params) {
+ if (key.equalsIgnoreCase(ContextHTTPConstant.CONTEXT_ID_STR)) {
+ contextId = value
+ }
+ }
+ if (StringUtils.isNotBlank(contextId)) {
+ dealContextAccess(contextId.toString, gatewayContext)
+ } else {
+ dealContextCreate(gatewayContext)
+ }
+ }
+ }else{
+ null
+ }
+ }
+
+ def dealContextCreate(gatewayContext:GatewayContext):ServiceInstance = {
+ val serviceId = findService(HaContextGatewayRouter.CONTEXT_SERVICE_STR, list => {
+ val services = list.filter(_.contains(HaContextGatewayRouter.CONTEXT_SERVICE_STR))
+ services.headOption
+ })
+ val serviceInstances = ServiceInstanceUtils.getRPCServerLoader.getServiceInstances(serviceId.orNull)
+ if (serviceInstances.size > 0) {
+ val index = new Random().nextInt(serviceInstances.size)
+ serviceInstances(index)
+ } else {
+ logger.error(s"No valid instance for service : " + serviceId.orNull)
+ null
+ }
+ }
+
+ def dealContextAccess(contextIdStr:String, gatewayContext: GatewayContext):ServiceInstance = {
+ val contextId : String = {
+ var tmpId : String = null
+ if (serializationHelper.accepts(contextIdStr)) {
+ val contextID : ContextID = serializationHelper.deserialize(contextIdStr).asInstanceOf[ContextID]
+ if (null != contextID) {
+ tmpId = contextID.getContextId
+ } else {
+ error(s"Deserializate contextID null. contextIDStr : " + contextIdStr)
+ }
+ } else {
+ error(s"ContxtIDStr cannot be deserialized. contextIDStr : " + contextIdStr)
+ }
+ if (null == tmpId) {
+ contextIdStr
+ } else {
+ tmpId
+ }
+ }
+ val instances = contextIDParser.parse(contextId)
+ var serviceId:Option[String] = None
+ serviceId = findService(HaContextGatewayRouter.CONTEXT_SERVICE_STR, list => {
+ val services = list.filter(_.contains(HaContextGatewayRouter.CONTEXT_SERVICE_STR))
+ services.headOption
+ })
+ val serviceInstances = ServiceInstanceUtils.getRPCServerLoader.getServiceInstances(serviceId.orNull)
+ if (instances.size() > 0) {
+ serviceId.map(ServiceInstance(_, instances.get(0))).orNull
+ } else if (serviceInstances.size > 0) {
+ serviceInstances(0)
+ } else {
+ logger.error(s"No valid instance for service : " + serviceId.orNull)
+ null
+ }
+ }
+
+}
+
+
+object HaContextGatewayRouter{
+ val CONTEXT_ID_STR:String = "contextId"
+ val CONTEXT_SERVICE_STR:String = "contextservice"
+ val CONTEXT_REGEX: Regex = (normalPath(API_URL_PREFIX) + "rest_[a-zA-Z][a-zA-Z_0-9]*/(v\\d+)/contextservice/" + ".+").r
+}
diff --git a/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/contextservice/ContextIdParserImpl.scala b/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/contextservice/ContextIdParserImpl.scala
new file mode 100644
index 0000000000..a0fed9ea9c
--- /dev/null
+++ b/gateway/gateway-ujes-support/src/main/scala/com/webank/wedatasphere/linkis/gateway/ujes/route/contextservice/ContextIdParserImpl.scala
@@ -0,0 +1,52 @@
+package com.webank.wedatasphere.linkis.gateway.ujes.route.contextservice
+
+import java.util
+import java.util.{ArrayList, List}
+
+import com.webank.wedatasphere.linkis.common.utils.Logging
+import com.webank.wedatasphere.linkis.cs.common.entity.source.{ContextIDParser, HAContextID}
+import com.webank.wedatasphere.linkis.cs.common.utils.CSHighAvailableUtils
+import com.webank.wedatasphere.linkis.rpc.instancealias.InstanceAliasManager
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Component
+
+
+/**
+ * created by cooperyang on 2020/2/19
+ * Description: 如果id为HAID,则解析出对应的instance
+ */
+@Component
+class ContextIdParserImpl extends ContextIDParser with Logging {
+
+ @Autowired
+ var instanceAliasManager : InstanceAliasManager = _
+
+ override def parse(contextId: String): util.List[String] = {
+
+ if (CSHighAvailableUtils.checkHAIDBasicFormat(contextId)) {
+ val instances = new util.ArrayList[String](2)
+ val haContextID = CSHighAvailableUtils.decodeHAID(contextId)
+ if (instanceAliasManager.isInstanceAliasValid(haContextID.getInstance)) {
+ instances.add(instanceAliasManager.getInstanceByAlias(haContextID.getInstance).getInstance)
+ } else {
+ error(s"parse HAID instance invalid. haIDKey : " + contextId)
+ }
+ if (instanceAliasManager.isInstanceAliasValid(haContextID.getBackupInstance)) {
+ instances.add(instanceAliasManager.getInstanceByAlias(haContextID.getBackupInstance).getInstance)
+ } else {
+ error("parse HAID backupInstance invalid. haIDKey : " + contextId)
+ }
+ instances
+ } else {
+ new util.ArrayList[String](0)
+ }
+ }
+
+ private def isNumberic(s:String):Boolean = {
+ s.toCharArray foreach {
+ c => if (c < 48 || c >57) return false
+ }
+ true
+ }
+
+}
diff --git a/gateway/springcloudgateway/src/main/scala/com/webank/wedatasphere/linkis/gateway/springcloud/SpringCloudGatewayConfiguration.scala b/gateway/springcloudgateway/src/main/scala/com/webank/wedatasphere/linkis/gateway/springcloud/SpringCloudGatewayConfiguration.scala
index 06b77a67a5..88b4cdf4b5 100644
--- a/gateway/springcloudgateway/src/main/scala/com/webank/wedatasphere/linkis/gateway/springcloud/SpringCloudGatewayConfiguration.scala
+++ b/gateway/springcloudgateway/src/main/scala/com/webank/wedatasphere/linkis/gateway/springcloud/SpringCloudGatewayConfiguration.scala
@@ -18,7 +18,6 @@ package com.webank.wedatasphere.linkis.gateway.springcloud
import com.netflix.loadbalancer.Server
import com.webank.wedatasphere.linkis.common.ServiceInstance
-import com.webank.wedatasphere.linkis.common.conf.CommonVars
import com.webank.wedatasphere.linkis.common.utils.Logging
import com.webank.wedatasphere.linkis.gateway.config.GatewaySpringConfiguration
import com.webank.wedatasphere.linkis.gateway.parser.{DefaultGatewayParser, GatewayParser}