@RequestMapping("/monitor/monitor-data-add") public RestfulResponse taskTrackerMonitorInfoAdd(MonitorDataAddRequest request) { RestfulResponse response = new RestfulResponse(); try { Assert.notNull(request.getNodeType(), "nodeType can not be null"); Assert.hasText(request.getIdentity(), "identity can not be null"); Assert.hasText(request.getNodeGroup(), "nodeGroup can not be null"); Assert.hasText(request.getMonitorData(), "monitorData can not be null"); if (NodeType.TASK_TRACKER.equals(request.getNodeType())) { monitorDataService.addTaskTrackerMonitorData(request); } else if (NodeType.JOB_TRACKER.equals(request.getNodeType())) { monitorDataService.addJobTrackerMonitorData(request); } else if (NodeType.JOB_CLIENT.equals(request.getNodeType())) { monitorDataService.addJobClientMonitorData(request); } response.setSuccess(true); return response; } catch (Exception e) { response.setSuccess(false); response.setMsg(e.getMessage()); return response; } }
@RequestMapping("node-group-del") public RestfulResponse delNodeGroup(NodeGroupRequest request) { RestfulResponse response = new RestfulResponse(); application.getNodeGroupStore().removeNodeGroup(request.getNodeType(), request.getNodeGroup()); if (NodeType.TASK_TRACKER.equals(request.getNodeType())) { application.getExecutableJobQueue().removeQueue(request.getNodeGroup()); } else if (NodeType.JOB_CLIENT.equals(request.getNodeType())) { application.getJobFeedbackQueue().removeQueue(request.getNodeGroup()); } response.setSuccess(true); return response; }
@RequestMapping("node-list-get") public RestfulResponse getNodeList(NodeRequest request) { RestfulResponse response = new RestfulResponse(); List<Node> nodes = registryService.getOnlineNodes(request); response.setSuccess(true); response.setResults(CollectionUtils.sizeOf(nodes)); response.setRows(nodes); return response; }
@RequestMapping("node-onoffline-log-get") public RestfulResponse delNodeGroup(NodeOnOfflineLogRequest request) { RestfulResponse response = new RestfulResponse(); Long results = nodeOnOfflineLogRepo.count(request); response.setResults(results.intValue()); if (results > 0) { List<NodeOnOfflineLog> rows = nodeOnOfflineLogRepo.select(request); response.setRows(rows); } else { response.setRows(new ArrayList<Object>(0)); } response.setSuccess(true); return response; }
@RequestMapping("node-group-get") public RestfulResponse getNodeGroup(NodeGroupRequest request) { RestfulResponse response = new RestfulResponse(); NodeGroupGetRequest nodeGroupGetRequest = new NodeGroupGetRequest(); nodeGroupGetRequest.setNodeGroup(request.getNodeGroup()); nodeGroupGetRequest.setNodeType(request.getNodeType()); PageResponse<NodeGroupPo> pageResponse = application.getNodeGroupStore().getNodeGroup(nodeGroupGetRequest); response.setResults(pageResponse.getResults()); response.setRows(pageResponse.getRows()); response.setSuccess(true); return response; }
@RequestMapping("/monitor/monitor-data-get") public RestfulResponse taskTrackerMonitorInfoGet(MonitorDataRequest request) { RestfulResponse response = new RestfulResponse(); if (request.getNodeType() == null) { response.setSuccess(false); response.setMsg("nodeType can not be null."); return response; } if (request.getStartTime() == null || request.getEndTime() == null) { response.setSuccess(false); response.setMsg("Search time range must be input."); return response; } List<? extends AbstractMonitorDataPo> rows = monitorDataService.queryMonitorDataSum(request); response.setSuccess(true); response.setRows(rows); response.setResults(CollectionUtils.sizeOf(rows)); return response; }