同步操作将从 ApacheLinkis/linkis 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Linkis provides an adaption method by WebSocket, for the convenience of the frontend of functional applications.
The data development IDE tool Scriptis 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.
Linkis defined its own specs for front-backend adaption.
1).URL specs
/api/rest_j/v1/{applicationName}/.+
/api/rest_s/v1/{applicationName}/.+
2).Request specs
{
"method":"/api/rest_j/v1/entrance/execute",
"data":{},
"websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
}
3).Response specs
{"method":"/api/rest_j/v1/entrance/execute","status":0, "message":Success!","data":{}}
1).Establish connection
Used to establish a WebSocket connection with Linkis.
/api/rest_j/entrance/connect
2).Request execution
Used to submit user jobs to Linkis for execution.
/api/rest_j/entrance/execute
POST
{
"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/Linkis.sql"
},
"websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
}
}
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
{
"method": "/api/rest_j/v1/entrance/execute",
"status": 0,
"message": "Execution request succeeded",
"data": {
"execID": "030418IDEhivebdpdwc010004:10087IDE_johnnwang_21",
"taskID": "123"
}
}
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
{
"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"
}
{
"method": "/api/rest_j/v1/entrance/${execID}/status",
"status": 0,
"message": "Return status information",
"data": {
"execID": "${execID}",
"taskID":28594,
"status": "Running",
},
"websocketTag":"37fcbd8b762d465a0c870684a0261c6e"
}
{
"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"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。