use of com.vip.saturn.job.console.domain.container.vo.ContainerVo in project Saturn by vipshop.
the class ContainerServiceImpl method getContainerVos.
@Override
public List<ContainerVo> getContainerVos() throws SaturnJobConsoleException {
List<ContainerVo> containerVos = new ArrayList<>();
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = curatorRepository.inSessionClient();
List<String> allUnSystemJobs = jobDimensionService.getAllUnSystemJobs(curatorFrameworkOp);
Map<String, List<String>> taskBindJobNames = getTaskBindJobNames(curatorFrameworkOp, allUnSystemJobs);
ContainerToken containerToken = getContainerToken();
List<String> tasks = getTasks(curatorFrameworkOp);
Map<String, List<ContainerExecutorVo>> containerExecutors = getContainerExecutors(curatorFrameworkOp, allUnSystemJobs);
if (tasks != null && !tasks.isEmpty()) {
for (String task : tasks) {
ContainerVo containerVo = new ContainerVo();
containerVo.setTaskId(task);
containerVo.setContainerExecutorVos(containerExecutors.get(task));
containerVo.setBindingJobNames(changeTypeOfBindingJobNames(taskBindJobNames.get(task)));
containerVo.setContainerStatus(changeTypeOfContainerStatus(containerToken, task));
ContainerConfig containerConfig = getContainerConfig(curatorFrameworkOp, task);
containerVo.setContainerConfig(changeTypeOfContainerConfig(containerConfig));
containerVo.setCreateTime(changeTypeOfCreateTime(containerConfig));
containerVo.setContainerScaleJobVos(getContainerScaleJobVos(task));
containerVo.setInstancesConfigured(String.valueOf(containerConfig.getInstances()));
containerVos.add(containerVo);
}
}
return containerVos;
}
use of com.vip.saturn.job.console.domain.container.vo.ContainerVo in project Saturn by vipshop.
the class ContainerController method getContainerVos.
@RequestMapping(value = "/getContainerVos", method = RequestMethod.GET)
public RequestResult getContainerVos(HttpServletRequest request) {
RequestResult requestResult = new RequestResult();
try {
List<ContainerVo> containerVos = containerService.getContainerVos();
requestResult.setSuccess(true);
requestResult.setObj(containerVos);
} catch (SaturnJobConsoleException e) {
requestResult.setSuccess(false);
requestResult.setMessage(e.getMessage());
} catch (Throwable t) {
requestResult.setSuccess(false);
requestResult.setMessage(t.toString());
}
return requestResult;
}
use of com.vip.saturn.job.console.domain.container.vo.ContainerVo in project Saturn by vipshop.
the class MarathonServiceImpl method getContainerVos.
@Override
public List<ContainerVo> getContainerVos(String namespace) throws SaturnJobConsoleException {
List<ContainerVo> containerVos = new ArrayList<>();
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = registryCenterService.getCuratorFrameworkOp(namespace);
List<String> allUnSystemJobs = jobService.getUnSystemJobNames(namespace);
Map<String, List<String>> taskBindJobNames = getTaskBindJobNames(curatorFrameworkOp, allUnSystemJobs);
ContainerToken containerToken = getContainerToken(namespace);
List<String> tasks = getTasks(curatorFrameworkOp);
Map<String, List<ContainerExecutorVo>> containerExecutors = getContainerExecutors(curatorFrameworkOp, allUnSystemJobs);
if (!tasks.isEmpty()) {
for (String task : tasks) {
ContainerVo containerVo = new ContainerVo();
containerVo.setTaskId(task);
containerVo.setContainerExecutorVos(containerExecutors.get(task));
containerVo.setBindingJobNames(changeTypeOfBindingJobNames(taskBindJobNames.get(task)));
containerVo.setContainerStatus(changeTypeOfContainerStatus(containerToken, task));
ContainerConfig containerConfig = JSON.parseObject(curatorFrameworkOp.getData(ContainerNodePath.getDcosTaskConfigNodePath(task)), ContainerConfig.class);
containerVo.setContainerConfig(changeTypeOfContainerConfig(containerConfig));
containerVo.setCreateTime(changeTypeOfCreateTime(containerConfig));
containerVo.setContainerScaleJobVos(getContainerScaleJobVos(namespace, task, curatorFrameworkOp));
containerVo.setInstancesConfigured(String.valueOf(containerConfig.getInstances()));
containerVos.add(containerVo);
}
}
return containerVos;
}
Aggregations