use of com.dtstack.taier.common.exception.RdosDefineException in project Taier by DTStack.
the class BatchFunctionService method deleteFunction.
/**
* 删除函数
* @param userId
* @param functionId
*/
@Transactional(rollbackFor = Exception.class)
public void deleteFunction(Long userId, Long functionId) {
BatchFunction batchFunction = developFunctionDao.getOne(functionId);
if (Objects.isNull(batchFunction)) {
throw new RdosDefineException(ErrorCode.FUNCTION_CAN_NOT_FIND);
}
if (FuncType.SYSTEM.getType().equals(batchFunction.getType())) {
throw new RdosDefineException(ErrorCode.SYSTEM_FUNCTION_CAN_NOT_MODIFY);
}
batchFunctionResourceService.deleteByFunctionId(functionId);
batchFunction = new BatchFunction();
batchFunction.setId(functionId);
batchFunction.setIsDeleted(Deleted.DELETED.getStatus());
batchFunction.setModifyUserId(userId);
addOrUpdate(batchFunction);
}
use of com.dtstack.taier.common.exception.RdosDefineException in project Taier by DTStack.
the class BatchFunctionService method moveFunction.
/**
* 移动函数
* @param userId
* @param functionId
* @param nodePid
*/
public void moveFunction(Long userId, Long functionId, Long nodePid) {
BatchFunction bf = developFunctionDao.getOne(functionId);
if (Objects.isNull(bf)) {
throw new RdosDefineException(ErrorCode.FUNCTION_CAN_NOT_FIND);
}
if (FuncType.SYSTEM.getType().equals(bf.getType())) {
throw new RdosDefineException(ErrorCode.SYSTEM_FUNCTION_CAN_NOT_MODIFY);
}
bf = new BatchFunction();
bf.setId(functionId);
bf.setNodePid(nodePid);
bf.setModifyUserId(userId);
addOrUpdate(bf);
}
use of com.dtstack.taier.common.exception.RdosDefineException in project Taier by DTStack.
the class BatchHadoopJobExeService method startSqlImmediately.
/**
* 真正运行SQL任务的逻辑
* @param userId
* @param tenantId
* @param uniqueKey
* @param taskId
* @param sql
* @param isRoot
* @param task
* @param dtToken
* @param isEnd
* @param jobId
* @return
* @throws Exception
*/
@Override
public ExecuteResultVO startSqlImmediately(Long userId, Long tenantId, String uniqueKey, Long taskId, String sql, Boolean isRoot, BatchTask task, String dtToken, Boolean isEnd, String jobId) throws Exception {
if (EScheduleJobType.SPARK_SQL.getVal().equals(task.getTaskType())) {
ExecuteContent content = new ExecuteContent();
content.setTenantId(tenantId).setUserId(userId).setSql(sql).setTaskId(taskId).setTaskType(task.getTaskType()).setPreJobId(jobId).setRootUser(isRoot).setCheckSyntax(environmentContext.getExplainEnable()).setIsdirtyDataTable(false).setSessionKey(uniqueKey).setEnd(isEnd);
return batchSqlExeService.executeSql(content);
}
throw new RdosDefineException(String.format("不支持%s类型的任务直接运行", EScheduleJobType.getByTaskType(task.getTaskType()).getName()));
}
use of com.dtstack.taier.common.exception.RdosDefineException in project Taier by DTStack.
the class BatchJobService method startSyncImmediately.
/**
* 运行同步任务
*
* @return
*/
public BatchStartSyncResultVO startSyncImmediately(Long taskId, Long userId, Boolean isRoot, Long tenantId) {
BatchStartSyncResultVO batchStartSyncResultVO = new BatchStartSyncResultVO();
batchStartSyncResultVO.setMsg(null);
batchStartSyncResultVO.setJobId(null);
batchStartSyncResultVO.setStatus(TaskStatus.SUBMITTING.getStatus());
BatchTask batchTask = batchTaskService.getOneWithError(taskId);
if (!batchTask.getTaskType().equals(EScheduleJobType.SYNC.getVal())) {
throw new RdosDefineException("只支持同步任务直接运行");
}
try {
IBatchJobExeService batchJobExeService = this.multiEngineServiceFactory.getBatchJobExeService(EScheduleJobType.SYNC.getType());
Map<String, Object> actionParam = batchJobExeService.readyForSyncImmediatelyJob(batchTask, tenantId, isRoot);
String extraInfo = JSON.toJSONString(actionParam);
ParamTaskAction paramTaskAction = new ParamTaskAction();
ScheduleTaskShade scheduleTaskShade = JSON.parseObject(extraInfo, ScheduleTaskShade.class);
scheduleTaskShade.setExtraInfo(extraInfo);
scheduleTaskShade.setTaskId(batchTask.getId());
scheduleTaskShade.setScheduleConf(batchTask.getScheduleConf());
scheduleTaskShade.setComponentVersion(batchTask.getComponentVersion());
paramTaskAction.setBatchTask(scheduleTaskShade);
ParamActionExt paramActionExt = actionService.paramActionExt(paramTaskAction.getBatchTask(), paramTaskAction.getJobId(), paramTaskAction.getFlowJobId());
String jobId = paramActionExt.getJobId();
actionService.start(paramActionExt);
String name = MathUtil.getString(actionParam.get("name"));
String job = MathUtil.getString(actionParam.get("job"));
batchSelectSqlService.addSelectSql(jobId, name, TempJobType.SYNC_TASK.getType(), batchTask.getTenantId(), job, userId, EScheduleJobType.SPARK_SQL.getType());
batchStartSyncResultVO.setMsg(String.format("任务提交成功,名称为: %s", name));
batchStartSyncResultVO.setJobId(jobId);
batchStartSyncResultVO.setStatus(TaskStatus.SUBMITTING.getStatus());
} catch (Exception e) {
LOGGER.warn("startSyncImmediately-->", e);
batchStartSyncResultVO.setMsg(e.getMessage());
batchStartSyncResultVO.setStatus(TaskStatus.SUBMITFAILD.getStatus());
}
return batchStartSyncResultVO;
}
use of com.dtstack.taier.common.exception.RdosDefineException in project Taier by DTStack.
the class BatchTaskService method handleKerberos.
/**
* kerberos配置预处理、替换相对路径为绝对路径等操作
*
* @param sourceType
* @param kerberosMap
* @param localKerberosConf
* @return
*/
private Map<String, Object> handleKerberos(Integer sourceType, Map<String, Object> kerberosMap, String localKerberosConf) {
IKerberos kerberos = ClientCache.getKerberos(sourceType);
HashMap<String, Object> tmpKerberosConfig = new HashMap<>(kerberosMap);
try {
kerberos.prepareKerberosForConnect(tmpKerberosConfig, localKerberosConf);
} catch (Exception e) {
throw new RdosDefineException("common-loader中kerberos配置文件处理失败", e);
}
return tmpKerberosConfig;
}
Aggregations