use of com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp in project Saturn by vipshop.
the class JobServiceImpl method getJobShardingAllocatedExecutorList.
@Override
public List<String> getJobShardingAllocatedExecutorList(String namespace, String jobName) throws SaturnJobConsoleException {
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = registryCenterService.getCuratorFrameworkOp(namespace);
String executorsPath = JobNodePath.getServerNodePath(jobName);
List<String> executors = curatorFrameworkOp.getChildren(executorsPath);
if (CollectionUtils.isEmpty(executors)) {
return Lists.newArrayList();
}
List<String> shardingList = Lists.newArrayList();
for (String executor : executors) {
String sharding = curatorFrameworkOp.getData(JobNodePath.getServerNodePath(jobName, executor, "sharding"));
if (StringUtils.isNotBlank(sharding)) {
shardingList.add(executor);
}
}
return shardingList;
}
use of com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp in project Saturn by vipshop.
the class ExecutorServiceImpl method dump.
@Override
public void dump(String namespace, String executorName) throws SaturnJobConsoleException {
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = getCuratorFrameworkOp(namespace);
String version = curatorFrameworkOp.getData(ExecutorNodePath.getExecutorVersionNodePath(executorName));
if (!isVersionSupportedDump(version)) {
throw new SaturnJobConsoleException(SaturnJobConsoleException.ERROR_CODE_BAD_REQUEST, "Saturn executor版本低于3.0.0无法进行一键dump");
}
String dumpNodePath = ExecutorNodePath.getExecutorDumpNodePath(executorName);
curatorFrameworkOp.delete(dumpNodePath);
curatorFrameworkOp.create(dumpNodePath);
}
use of com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp in project Saturn by vipshop.
the class ExecutorServiceImpl method restart.
@Override
public void restart(String namespace, String executorName) throws SaturnJobConsoleException {
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = getCuratorFrameworkOp(namespace);
String restartNodePath = ExecutorNodePath.getExecutorRestartNodePath(executorName);
curatorFrameworkOp.delete(restartNodePath);
curatorFrameworkOp.create(restartNodePath);
}
use of com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp in project Saturn by vipshop.
the class ExecutorServiceImpl method removeExecutor.
@Override
public void removeExecutor(String namespace, String executorName) throws SaturnJobConsoleException {
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = getCuratorFrameworkOp(namespace);
curatorFrameworkOp.deleteRecursive(ExecutorNodePath.getExecutorNodePath(executorName));
List<String> jobNames = jobService.getAllJobNamesFromZK(namespace);
if (CollectionUtils.isEmpty(jobNames)) {
return;
}
for (String jobName : jobNames) {
String executorNode = JobNodePath.getServerNodePath(jobName, executorName);
curatorFrameworkOp.deleteRecursive(executorNode);
}
}
use of com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp in project Saturn by vipshop.
the class ExecutorServiceImpl method getExecutors.
@Override
public List<ServerBriefInfo> getExecutors(String namespace, ServerStatus expectedServerStatus) throws SaturnJobConsoleException {
CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = getCuratorFrameworkOp(namespace);
List<String> executors = curatorFrameworkOp.getChildren(ExecutorNodePath.getExecutorNodePath());
if (executors == null || executors.isEmpty()) {
return Lists.newArrayList();
}
List<ServerBriefInfo> executorInfoList = Lists.newArrayList();
for (String executor : executors) {
ServerBriefInfo executorInfo = getServerBriefInfo(executor, curatorFrameworkOp);
if (expectedServerStatus == null || executorInfo.getStatus() == expectedServerStatus) {
executorInfoList.add(executorInfo);
}
}
return executorInfoList;
}
Aggregations