Skip to content

Commit

Permalink
Upgrade sql and update ExchangisJobDssAppConnRestfulApi
Browse files Browse the repository at this point in the history
  • Loading branch information
jefftlin committed Jun 11, 2024
1 parent 0b6c2d6 commit fad8031
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions db/1.1.3/exchangis_ddl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE exchangis_launchable_task CHANGE linkis_job_content linkis_job_content mediumtext NULL;
4 changes: 2 additions & 2 deletions db/exchangis_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CREATE TABLE `exchangis_project_user` (
`priv` int(20) DEFAULT NULL,
`last_update_time` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `exchangis_project_user_un` (`project_id`)
UNIQUE KEY `exchangis_project_user_un` (`project_id`,`priv_user`,`priv`)
) ENGINE=InnoDB AUTO_INCREMENT=844 DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=COMPACT;

-- exchangis_launchable_task definition
Expand All @@ -106,7 +106,7 @@ CREATE TABLE `exchangis_launchable_task` (
`engine_type` varchar(45) DEFAULT '',
`execute_user` varchar(50) DEFAULT '',
`linkis_job_name` varchar(100) NOT NULL,
`linkis_job_content` text NOT NULL,
`linkis_job_content` mediumtext NOT NULL,
`linkis_params` text DEFAULT NULL,
`linkis_source` varchar(64) DEFAULT NULL,
`labels` varchar(64) DEFAULT NULL,
Expand Down
6 changes: 3 additions & 3 deletions db/exchangis_dml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ INSERT INTO `exchangis_job_param_config` (config_key,config_name,config_directio
('writeMode','写入方式','SQOOP-SINK','HIVE','OPTION','writeMode','写入方式(OVERWRITE只对TEXT类型表生效)','',1,'OPTION','["OVERWRITE","APPEND"]','OVERWRITE','','','写入方式输入错误',0,0,'',1,'',1,'',1,NULL)
,('partition','分区信息','SINK','HIVE','MAP','partition','分区信息(文本)','',0,'VARCHAR','','','REGEX','^[\\s\\S]{0,50}$','分区信息过长',0,0,'/api/rest_j/v1/dss/exchangis/main/datasources/render/partition/element/map',1,'',2,'',1,NULL)
,('partition','分区信息','SOURCE','HIVE','MAP','partition','分区信息(文本)','',0,'VARCHAR','','','REGEX','^[\\s\\S]{0,50}$','分区信息过长',0,0,'/api/rest_j/v1/dss/exchangis/main/datasources/render/partition/element/map',1,'',2,'',1,NULL);
,('transferMode','传输方式','DATAX-SOURCE','HIVE','OPTION','transferMode','传输方式','',1,'OPTION','["二进制","记录"]','二进制','','','该传输方式不可用',0,0,'',1,'',1,'',1,NULL)
,('nullFormat','空值字符','DATAX-SOURCE','HIVE','INPUT','nullFormat','空值字符','',0,'VARCHAR','','','REGEX','^[\\s\\S]{0,50}$','空值字符输入错误',0,0,'',1,'',2,'',1,49)
,('transferMode','传输方式','DATAX-SOURCE','HIVE','OPTION','transferMode','传输方式','',1,'OPTION','["记录"]','二进制','','','该传输方式不可用',0,0,'',1,'',1,'',1,NULL)
,('nullFormat','空值字符','DATAX-SOURCE','HIVE','INPUT','nullFormat','空值字符','',0,'VARCHAR','','','REGEX','^[\\s\\S]{0,50}$','空值字符输入错误',0,0,'',1,'',2,'',1,48)
,('writeMode','写入方式','DATAX-SINK','HIVE','OPTION','writeMode','写入方式(OVERWRITE只对TEXT类型表生效)','',1,'OPTION','["append","truncate"]','append','','','写入方式输入错误',0,0,'',1,'',1,'',1,NULL)
,('nullFormat','空值字符','DATAX-SINK','HIVE','INPUT','nullFormat','空值字符','',0,'VARCHAR','','','REGEX','^[\\s\\S]{0,50}$','空值字符输入错误',0,0,'',1,'',2,'',1,49);

Expand All @@ -73,7 +73,7 @@ INSERT INTO `exchangis_job_param_config` (config_key,config_name,config_directio
,('batchSize','批量大小','DATAX-SINK','MONGODB','INPUT','batchSize','批量大小','',0,'NUMBER','','','REGEX','^[1-9]\\d*$','批量大小输入错误',0,0,'',1,'',2,'',1,NULL);

INSERT INTO `exchangis_job_param_config` (config_key,config_name,config_direction,`type`,ui_type,ui_field,ui_label,unit,required,value_type,value_range,default_value,validate_type,validate_range,validate_msg,is_hidden,is_advanced,source,`level`,treename,sort,description,status,ref_id) VALUES
('writeMode','写入方式','DATAX-SINK','STARROCKS','OPTION','writeMode','写入方式','',1,'OPTION','["insert"]','insert','','','写入方式输入错误',0,0,'',1,'',1,'',1,NULL)
('writeMode','写入方式','DATAX-SINK','STARROCKS','OPTION','writeMode','写入方式','',1,'OPTION','["upsert"]','upsert','','','写入方式输入错误',0,0,'',1,'',1,'',1,NULL)
,('batchSize','批量字节数大小','DATAX-SINK','STARROCKS','INPUT','maxBatchSize','批量字节数大小','',0,'NUMBER','','','REGEX','^[1-9]\\d*$','批量大小输入错误',0,0,'',1,'',2,'',1,NULL);

-- engine_settings records
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class ExchangisJobVo {
/**
* Project id
*/
@NotNull(groups = InsertGroup.class, message = "Project id cannot be null (工程ID不能为空)")
private Long projectId;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public Message createJob(
} catch (Exception e){
String message = "Fail to create dss job: " + exchangisJobVo.getJobName() +" (创建DSS任务失败)";
LOG.error(message, e);
response = Message.error(message);
return Message.error(message);
}
assert id != null;
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, id.toString(), "Job name is: " + exchangisJobVo.getJobName(), OperateTypeEnum.CREATE, request);
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, String.valueOf(id), "Job name is: " + exchangisJobVo.getJobName(), OperateTypeEnum.CREATE, request);
return response;
}

Expand Down Expand Up @@ -115,9 +115,9 @@ public Message deleteJob(@PathVariable("id") Long id, HttpServletRequest request
} catch (Exception e){
String message = "Fail to delete dss job [ id: " + id + "] (删除DSS任务失败)";
LOG.error(message, e);
response = Message.error(message);
return Message.error(message);
}
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, id.toString(), "Job", OperateTypeEnum.DELETE, request);
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, String.valueOf(id), "Job", OperateTypeEnum.DELETE, request);
return response;
}

Expand Down Expand Up @@ -155,9 +155,9 @@ public Message updateJob(@PathVariable("id") Long id,
} catch (Exception e){
String message = "Fail to update dss job: " + exchangisJobVo.getJobName() +" (更新DSS任务失败)";
LOG.error(message, e);
response = Message.error(message);
return Message.error(message);
}
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, id.toString(), "Job name is: " + exchangisJobVo.getJobName(), OperateTypeEnum.UPDATE, request);
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, String.valueOf(id), "Job name is: " + exchangisJobVo.getJobName(), OperateTypeEnum.UPDATE, request);
return response;
}

Expand All @@ -178,7 +178,7 @@ public Message executeJob(@PathVariable("id") Long id, HttpServletRequest reques
String submitUser = params.get("submitUser").toString();
String oringinUser = SecurityFilter.getLoginUsername(request);
String loginUser = UserUtils.getLoginUser(request);
Message result = Message.ok();
Message response = Message.ok();
ExchangisJobInfo jobInfo = null;
LOG.info("wds execute user: {}", loginUser);
try {
Expand All @@ -203,7 +203,7 @@ public Message executeJob(@PathVariable("id") Long id, HttpServletRequest reques
// Send to execute service
String jobExecutionId = executeService.executeJob(jobInfo, StringUtils.isNotBlank(jobInfo.getExecuteUser()) ?
jobInfo.getExecuteUser() : loginUser);
result.data("jobExecutionId", jobExecutionId);
response.data("jobExecutionId", jobExecutionId);

LOG.info("Prepare to get job status");
/*while (true) {
Expand All @@ -223,15 +223,16 @@ public Message executeJob(@PathVariable("id") Long id, HttpServletRequest reques
String message;
if (Objects.nonNull(jobInfo)) {
message = "Error occur while executing job: [id: " + jobInfo.getId() + " name: " + jobInfo.getName() + "]";
result = Message.error(message + "(执行任务出错), reason: " + e.getMessage());
response = Message.error(message + "(执行任务出错), reason: " + e.getMessage());
} else {
message = "Error to get the job detail (获取任务信息出错)";
result = Message.error(message);
response = Message.error(message);
}
LOG.error(message, e);
return response;
}
assert jobInfo != null;
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, id.toString(), "Execute task is: " + jobInfo.getName(), OperateTypeEnum.EXECUTE, request);
return result;
AuditLogUtils.printLog(oringinUser, loginUser, TargetTypeEnum.JOB, String.valueOf(id), "Execute task is: " + jobInfo.getName(), OperateTypeEnum.EXECUTE, request);
return response;
}
}
24 changes: 12 additions & 12 deletions exchangis-plugins/exchangis-appconn/src/main/resources/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ insert into `dss_workflow_node` (`name`, `appconn_name`, `node_type`, `jump_type
values('datax','exchangis','linkis.appconn.exchangis.datax',1,'1','1','0','1','icons/datax.icon');

-- 节点组表dss_workflow_node_to_group
INSERT INTO `dss_workflow_node_to_group`(`node_id`,`group_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop'), (select id from `dss_workflow_node_group` where `name` = '数据交换'));
INSERT INTO `dss_workflow_node_to_group`(`node_id`,`group_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax'), (select id from `dss_workflow_node_group` where `name` = '数据交换'));
INSERT INTO `dss_workflow_node_to_group`(`node_id`,`group_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop' limit 1), (select id from `dss_workflow_node_group` where `name` = '数据交换'));
INSERT INTO `dss_workflow_node_to_group`(`node_id`,`group_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax' limit 1), (select id from `dss_workflow_node_group` where `name` = '数据交换'));

-- 节点UI表dss_workflow_node_to_ui
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop'), 1);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop'), 2);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop'), 3);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop'), 4);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop'), 5);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax'), 1);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax'), 2);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax'), 3);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax'), 4);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax'), 5);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop' limit 1), 1);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop' limit 1), 2);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop' limit 1), 3);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop' limit 1), 4);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.sqoop' limit 1), 5);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax' limit 1), 1);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax' limit 1), 2);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax' limit 1), 3);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax' limit 1), 4);
INSERT INTO `dss_workflow_node_to_ui`(`workflow_node_id`,`ui_id`) values ((select id from `dss_workflow_node` where `node_type` = 'linkis.appconn.exchangis.datax' limit 1), 5);

0 comments on commit fad8031

Please sign in to comment.