Skip to content

Commit

Permalink
解决yarn应用name参数和class参数同名时导致的提交失败BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
progr1mmer committed Jul 14, 2020
1 parent f8e7dcc commit 27461e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
//启动监控任务
startMonitor();
//启动定时任务
startTimerTask();
startScheduling();
}

private void startResidentMission() {
Expand Down Expand Up @@ -76,7 +76,7 @@ private void startMonitor() {
});
}

private void startTimerTask() {
private void startScheduling() {
List<Scheduling> schedulings = schedulingService.findByQuery("status=" + Constant.STATUS_ON);
schedulings.forEach(scheduling -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ public void execute(JobExecutionContext jobExecutionContext) {
}
//为确保调度流程的准确性,应用名称添加实例ID
if (scheduling != null) {
command = command.replace(" " + script.getApp() + " ", " " + script.getApp() + "_instance" + dateFormat.format(now) + " ");
if (script.getType() == Constant.SCRIPT_TYPE_SPARK_BATCH) {
command = command.replace("--name " + script.getApp(), "--name " + script.getApp() + "_instance" + dateFormat.format(now));
} else if (script.getType() == Constant.SCRIPT_TYPE_FLINK_BATCH) {
command = command.replace("-ynm " + script.getApp(), "-ynm " + script.getApp() + "_instance" + dateFormat.format(now));
}
}
session.execCommand(command);
if (!interrupted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
// * 7. 运行此测试
// * 8. 删除第2步中添加的代码
// * 9. 执行第3步中注释的SQL语句
// * 10. 升级完毕
// * 10. 执行SQL: UPDATE `scheduling` SET `last_execute_time` = Null;
// * 11. 升级完毕
// */
//@SpringBootTest
//@RunWith(SpringRunner.class)
Expand Down

0 comments on commit 27461e7

Please sign in to comment.