Commit d4b31294 authored by mcb's avatar mcb

no message

parent bc4fcb94
...@@ -95,7 +95,7 @@ public class AzkabanApiUtils2 { ...@@ -95,7 +95,7 @@ public class AzkabanApiUtils2 {
String sessionId = SessionUtils.getSession().getId(); //"dcfc608c-c58a-45b7-adc7-9902b652496e"; String sessionId = SessionUtils.getSession().getId(); //"dcfc608c-c58a-45b7-adc7-9902b652496e";
//String sessionId = "f70d53fa-55da-4688-8d00-64350e4fb8ea"; //String sessionId = "f70d53fa-55da-4688-8d00-64350e4fb8ea";
System.err.println("----"+sessionId); System.err.println("----sessionId="+sessionId);
return sessionId; //SessionUtils.getSession().getId(); return sessionId; //SessionUtils.getSession().getId();
} }
...@@ -502,7 +502,7 @@ public class AzkabanApiUtils2 { ...@@ -502,7 +502,7 @@ public class AzkabanApiUtils2 {
String execIdsStr = ""; String execIdsStr = "";
//将所有的实例停止 //将所有的实例停止
for (Integer execid : execIds) { for (Integer execid : execIds) {
LOGGER.info("execid:"+execid); LOGGER.info("######执行实例execid:"+execid);
cancleFlow(sessionId, execid); cancleFlow(sessionId, execid);
execIdsStr= execIdsStr +","+ execid; execIdsStr= execIdsStr +","+ execid;
} }
......
...@@ -98,6 +98,31 @@ public class OfflineSynchController { ...@@ -98,6 +98,31 @@ public class OfflineSynchController {
return list; return list;
} }
/**
* 任务停止运行
*
* @return
* @author Bellamy
* @since 2021-01-07
*/
@ApiOperation(value = "停止运行", notes = "停止运行")
@GetMapping(value = "/stopSyncingTask")
@ApiImplicitParam(name = "taskId", value = "任务id")
public JsonResult stopTaskRunNowByTaskId(@RequestParam(value = "taskId") String taskId) throws Exception {
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR);
}
JsonResult list = new JsonResult();
try {
list = offlineSynchService.stopSyncingTaskByTaskId(taskId);
} catch (Exception e) {
list.setMessage(e.getMessage());
list.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return list;
}
/** /**
* 根据taskId删除离线任务 * 根据taskId删除离线任务
* *
......
...@@ -102,4 +102,13 @@ public interface OfflineSynchService { ...@@ -102,4 +102,13 @@ public interface OfflineSynchService {
* @since 2021-01-21 * @since 2021-01-21
*/ */
JsonResult querySoureTableColumns(SoureTableColumnsReq req) throws Exception; JsonResult querySoureTableColumns(SoureTableColumnsReq req) throws Exception;
/**
* 任务停止运行
*
* @return
* @author Bellamy
* @since 2021-01-07
*/
JsonResult stopSyncingTaskByTaskId(String taskId) throws Exception;
} }
...@@ -734,4 +734,25 @@ public class OfflineSynchServiceImpl implements OfflineSynchService { ...@@ -734,4 +734,25 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
} }
} }
/**
* 任务停止运行
*
* @return
* @author Bellamy
* @since 2021-01-07
*/
@Override
public JsonResult stopSyncingTaskByTaskId(String taskId) throws Exception {
//根据任务id,查询DMP资源导航树和DW系统配置信息
Map<String, Object> map = offlineSynchDao.selectNavigationTreeByTaskId(taskId);
if (map == null || map.size() == 0) {
throw new RuntimeException("任务数据信息不存在");
}
String azkabanMonitorUrl = map.get("azkabanMonitorUrl").toString();
Long projectId = Long.valueOf(map.get("projectId").toString());
AzkabanApiUtils2 azkabanApiUtils = new AzkabanApiUtils2(azkabanMonitorUrl);
String execId = azkabanApiUtils.stopFlow("jz_localflow_" + projectId, map.get("treeName").toString());
return JsonResult.ok();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment