|
21 | 21 | import com.webank.wedatasphere.streamis.jobmanager.exception.JobException; |
22 | 22 | import com.webank.wedatasphere.streamis.jobmanager.exception.JobExceptionManager; |
23 | 23 | import com.webank.wedatasphere.streamis.jobmanager.launcher.conf.JobConfKeyConstants; |
| 24 | +import com.webank.wedatasphere.streamis.jobmanager.launcher.dao.StreamJobConfMapper; |
24 | 25 | import com.webank.wedatasphere.streamis.jobmanager.launcher.job.JobInfo; |
25 | 26 | import com.webank.wedatasphere.streamis.jobmanager.launcher.job.conf.JobConf; |
26 | 27 | import com.webank.wedatasphere.streamis.jobmanager.launcher.job.manager.JobLaunchManager; |
|
41 | 42 | import com.webank.wedatasphere.streamis.jobmanager.manager.service.StreamTaskService; |
42 | 43 | import com.webank.wedatasphere.streamis.jobmanager.manager.transform.entity.RealtimeLogEntity; |
43 | 44 | import com.webank.wedatasphere.streamis.jobmanager.manager.transform.entity.StreamisTransformJobContent; |
| 45 | +import com.webank.wedatasphere.streamis.jobmanager.manager.utils.SourceUtils; |
44 | 46 | import com.webank.wedatasphere.streamis.jobmanager.manager.utils.StreamTaskUtils; |
45 | 47 | import com.webank.wedatasphere.streamis.jobmanager.utils.RegularUtil; |
46 | 48 | import com.webank.wedatasphere.streamis.jobmanager.vo.BulkUpdateLabel; |
@@ -86,6 +88,8 @@ public class JobRestfulApi { |
86 | 88 | @Autowired |
87 | 89 | private DefaultStreamJobService defaultStreamJobService; |
88 | 90 |
|
| 91 | + @Autowired |
| 92 | + private StreamJobConfMapper streamJobConfMapper; |
89 | 93 | @Resource |
90 | 94 | private JobLaunchManager<? extends JobInfo> jobLaunchManager; |
91 | 95 |
|
@@ -290,6 +294,7 @@ public Message executeInspect(HttpServletRequest req, @RequestParam(value = "job |
290 | 294 | inspections = inspectResult.stream().map(JobInspectVo::getInspectName) |
291 | 295 | .collect(Collectors.toList()); |
292 | 296 | } catch (Exception e){ |
| 297 | + LOG.warn(e.getMessage()); |
293 | 298 | return Message.error("Fail to inspect job " + jobId + " of the execution(任务执行前检查失败), message: " + e.getMessage()); |
294 | 299 | } |
295 | 300 |
|
@@ -338,13 +343,19 @@ public Message executeJob(HttpServletRequest req, @RequestBody Map<String, Objec |
338 | 343 | return Message.error("The system does not enable the detach feature ,detach job cannot start [" + jobId + "]"); |
339 | 344 | } |
340 | 345 | StreamJobVersion jobVersion = this.defaultStreamJobService.getLatestJobVersion(jobId); |
341 | | - String source = jobVersion.getSource(); |
342 | | - HashMap<Object, Object> sourceMap = new HashMap<>(); |
343 | | - sourceMap = BDPJettyServerHelper.gson().fromJson(source, HashMap.class); |
344 | | - if (sourceMap.containsKey("isHighAvailable")) { |
345 | | - if(!((Boolean) sourceMap.get("isHighAvailable"))){ |
346 | | - return Message.error("The master and backup cluster materials do not match, please check the material"); |
347 | | - } |
| 346 | + String highAvailablePolicy = streamJobConfMapper.getRawConfValue(jobId, "wds.streamis.app.highavailable.policy"); |
| 347 | + JobHighAvailableVo inspectVo = new JobHighAvailableVo(); |
| 348 | + Optional<String> sourceOption = Optional.ofNullable(jobVersion.getSource()); |
| 349 | + if(sourceOption.isPresent()) { |
| 350 | + String source = sourceOption.get(); |
| 351 | + inspectVo = SourceUtils.manageJobProjectFile(highAvailablePolicy, source); |
| 352 | + } else { |
| 353 | + LOG.warn("this job source is null"); |
| 354 | + inspectVo.setHighAvailable(true); |
| 355 | + inspectVo.setMsg("用户直接从页面上传,job的source为空,跳过高可用检查"); |
| 356 | + } |
| 357 | + if (!inspectVo.isHighAvailable()){ |
| 358 | + return Message.error("The master and backup cluster materials do not match, please check the material"); |
348 | 359 | } |
349 | 360 | try { |
350 | 361 | streamTaskService.execute(jobId, 0L, userName); |
|
0 commit comments