热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.spotify.helios.master.ZooKeeperMasterModel类的使用及代码示例

本文整理了Java中com.spotify.helios.master.ZooKeeperMasterModel类的一些代码示例,展示了ZooKeeperMasterModel类的具体用法。这些代码示

本文整理了Java中com.spotify.helios.master.ZooKeeperMasterModel类的一些代码示例,展示了ZooKeeperMasterModel类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperMasterModel类的具体详情如下:
包路径:com.spotify.helios.master.ZooKeeperMasterModel
类名称:ZooKeeperMasterModel

ZooKeeperMasterModel介绍

[英]The Helios Master's view into ZooKeeper.
[中]赫利奥斯大师对动物园管理员的看法。

代码示例

代码示例来源:origin: spotify/helios

@Before
public void setUp() throws Exception {
// make zookeeper interfaces
curator = zk().curatorWithSuperAuth();
final ZooKeeperClientProvider zkcp = new ZooKeeperClientProvider(
new DefaultZooKeeperClient(curator), ZooKeeperModelReporter.noop());
final List eventSenders = Collections.emptyList();
zkMasterModel = new ZooKeeperMasterModel(zkcp, getClass().getName(), eventSenders, "");
startDefaultMaster();
agent = startDefaultAgent(TEST_HOST);
client = defaultClient();
awaitHostRegistered(client, TEST_HOST, LONG_WAIT_SECONDS, SECONDS);
}

代码示例来源:origin: spotify/helios

final String token)
throws HostNotFoundException, JobNotDeployedException, TokenVerificationException {
assertHostExists(client, host);
final Deployment deployment = getDeployment(host, jobId);
if (deployment == null) {
throw new JobNotDeployedException(host, jobId);
final Job job = getJob(client, jobId);
verifyToken(token, job);
final String cOnfigHostJobPath= Paths.configHostJob(host, jobId);
nodes.add(Paths.configJobHost(jobId, host));
final List staticPorts = staticPorts(job);
for (final int port : staticPorts) {
nodes.add(Paths.configHostPort(host, port));

代码示例来源:origin: spotify/helios

/**
* Used to update the existing deployment of a job.
*/
@Override
public void updateDeployment(final String host, final Deployment deployment, final String token)
throws HostNotFoundException, JobNotDeployedException, TokenVerificationException {
log.info("updating deployment {}: {}", deployment, host);
final ZooKeeperClient client = provider.get("updateDeployment");
final JobId jobId = deployment.getJobId();
final Job job = getJob(client, jobId);
final Deployment existingDeployment = getDeployment(host, jobId);
if (job == null) {
throw new JobNotDeployedException(host, jobId);
}
verifyToken(token, job);
assertHostExists(client, host);
assertTaskExists(client, host, deployment.getJobId());
final String path = Paths.configHostJob(host, jobId);
final Task task = new Task(job, deployment.getGoal(),
existingDeployment.getDeployerUser(),
existingDeployment.getDeployerMaster(),
existingDeployment.getDeploymentGroupName());
try {
client.setData(path, task.toJsonBytes());
} catch (Exception e) {
throw new HeliosRuntimeException("updating deployment " + deployment
+ " on host " + host + " failed", e);
}
}

代码示例来源:origin: spotify/helios

final ZooKeeperClient client = provider.get("getJobStatus");
final Job job = getJob(client, jobId);
if (job == null) {
return null;
hosts = listJobHosts(client, jobId);
} catch (JobDoesNotExistException e) {
return null;
final ImmutableMap.Builder taskStatuses = ImmutableMap.builder();
for (final String host : hosts) {
final TaskStatus taskStatus = getTaskStatus(client, host, jobId);
if (taskStatus != null) {
taskStatuses.put(host, taskStatus);
final Deployment deployment = getDeployment(host, jobId);
if (deployment != null) {
deployments.put(host, deployment);

代码示例来源:origin: spotify/helios

/**
* Returns the current status of the host named by {@code host}.
*/
@Override
public HostStatus getHostStatus(final String host) {
final ZooKeeperClient client = provider.get("getHostStatus");
if (!ZooKeeperRegistrarUtil.isHostRegistered(client, host)) {
log.warn("Host {} isn't registered in ZooKeeper.", host);
return null;
}
final boolean up = checkHostUp(client, host);
final HostInfo hostInfo = getHostInfo(client, host);
final AgentInfo agentInfo = getAgentInfo(client, host);
final Map tasks = getTasks(client, host);
final Map statuses = getTaskStatuses(client, host);
final Map envirOnment= getEnvironment(client, host);
final Map labels = getLabels(client, host);
return HostStatus.newBuilder()
.setJobs(tasks)
.setStatuses(fromNullable(statuses).or(EMPTY_STATUSES))
.setHostInfo(hostInfo)
.setAgentInfo(agentInfo)
.setStatus(up ? UP : DOWN)
.setEnvironment(environment)
.setLabels(labels)
.build();
}

代码示例来源:origin: spotify/helios

final Job job = getJob(id);
verifyToken(token, job);
final String taskCreatiOnPath= Paths.configHostJobCreation(host, id, operationId);
final List staticPorts = staticPorts(job);
final Map portNodes = Maps.newHashMap();
final byte[] idJson = id.toJsonBytes();
} catch (NoNodeException e) {
assertJobExists(client, id);
assertHostExists(client, host);
deployJobRetry(client, host, deployment, count + 1, token);
} catch (NodeExistsException e) {
checkForPortConflicts(client, host, port, id);

代码示例来源:origin: spotify/helios

final DeploymentGroup deploymentGroup,
final String host) {
final TaskStatus taskStatus = getTaskStatus(client, host, deploymentGroup.getJobId());
final JobId jobId = deploymentGroup.getJobId();
final Deployment deployment = getDeployment(host, jobId);
if (deployment == null) {
return opFactory.error(
if (isRolloutTimedOut(client, deploymentGroup)) {
return opFactory.error("timed out while retrieving job status", host,
RollingUpdateError.TIMED_OUT_RETRIEVING_JOB_STATUS);
if (isRolloutTimedOut(client, deploymentGroup)) {
return rollingUpdateTimedoutError(opFactory, host, jobId, taskStatus);
final Deployment deployment = getDeployment(host, deploymentGroup.getJobId());
if (deployment == null) {
return opFactory.error(

代码示例来源:origin: spotify/helios

@Test
public void testMaster() throws Exception {
final JobId jobId = createAndAwaitJobRunning();
// shut down the agent so it cannot remove the tombstone we make
agent.stopAsync().awaitTerminated();
// make sure things look correct before
assertFalse(zkMasterModel.getJobs().isEmpty());
assertEquals(START, zkMasterModel.getDeployment(TEST_HOST, jobId).getGoal());
// undeploy job
client.undeploy(jobId, TEST_HOST).get();
// These used to be filtered away
assertNull(zkMasterModel.getDeployment(TEST_HOST, jobId));
assertTrue(zkMasterModel.getHostStatus(TEST_HOST).getJobs().isEmpty());
}

代码示例来源:origin: at.molindo/helios-services

private RollingUpdateTaskResult rollingUpdateAwaitRunning(final DeploymentGroup deploymentGroup,
final String host) {
final ZooKeeperClient client = provider.get("rollingUpdateAwaitRunning");
final Map taskStatuses = getTaskStatuses(client, host);
final Deployment deployment = getDeployment(host, deploymentGroup.getJobId());
if (deployment == null) {
return RollingUpdateTaskResult.error(
if (isRolloutTimedOut(deploymentGroup, client)) {
return RollingUpdateTaskResult.error("timed out while retrieving job status", host);
if (isRolloutTimedOut(deploymentGroup, client)) {
final Deployment deployment = getDeployment(host, deploymentGroup.getJobId());
if (deployment == null) {
return RollingUpdateTaskResult.error(

代码示例来源:origin: spotify/helios

.filter(host -> checkHostUp(zooKeeperClient, host))
.collect(Collectors.toList());
final List upHostsToDeploy = updateHostsCopy.stream()
.filter(host -> checkHostUp(zooKeeperClient, host))
.collect(Collectors.toList());

代码示例来源:origin: spotify/helios

/**
* Creates a config entry within the specified agent to un/deploy a job, or more generally, change
* the deployment status according to the {@code Goal} value in {@link Deployment}.
*/
@Override
public void deployJob(final String host, final Deployment deployment, final String token)
throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException,
JobPortAllocationConflictException, TokenVerificationException {
final ZooKeeperClient client = provider.get("deployJob");
deployJobRetry(client, host, deployment, 0, token);
}

代码示例来源:origin: spotify/helios

@Override
public void deployJob(String host, Deployment job)
throws HostNotFoundException, JobAlreadyDeployedException, JobDoesNotExistException,
JobPortAllocationConflictException {
try {
deployJob(host, job, Job.EMPTY_TOKEN);
} catch (TokenVerificationException e) {
throw new RuntimeException(e);
}
}

代码示例来源:origin: spotify/helios

private RollingUpdateOp rollingUpdateDeploy(final ZooKeeperClient client,
final RollingUpdateOpFactory opFactory,
final DeploymentGroup deploymentGroup,
final String host) {
final Deployment deployment = Deployment.of(deploymentGroup.getJobId(), Goal.START,
Deployment.EMTPY_DEPLOYER_USER, this.name,
deploymentGroup.getName());
try {
final String token = MoreObjects.firstNonNull(
deploymentGroup.getRolloutOptions().getToken(), Job.EMPTY_TOKEN);
return opFactory.nextTask(getDeployOperations(client, host, deployment, token));
} catch (JobDoesNotExistException e) {
return opFactory.error(e, host, RollingUpdateError.JOB_NOT_FOUND);
} catch (TokenVerificationException e) {
return opFactory.error(e, host, RollingUpdateError.TOKEN_VERIFICATION_ERROR);
} catch (HostNotFoundException e) {
return opFactory.error(e, host, RollingUpdateError.HOST_NOT_FOUND);
} catch (JobPortAllocationConflictException e) {
return opFactory.error(e, host, RollingUpdateError.PORT_CONFLICT);
} catch (JobAlreadyDeployedException e) {
// Nothing to do
return opFactory.nextTask();
}
}

代码示例来源:origin: spotify/helios

@Override
public AgentInfo getAgentInfo(final String host) {
return getAgentInfo(provider.get("getAgentInfo"), host);
}

代码示例来源:origin: spotify/helios

@Override
public boolean isHostUp(final String host) {
final ZooKeeperClient client = provider.get("isHostUp");
return ZooKeeperRegistrarUtil.isHostRegistered(client, host) && checkHostUp(client, host);
}

代码示例来源:origin: at.molindo/helios-services

final boolean up = checkHostUp(client, host);
final HostInfo hostInfo = getHostInfo(client, host);
final AgentInfo agentInfo = getAgentInfo(client, host);
final Map tasks = getTasks(client, host);
final Map statuses = getTaskStatuses(client, host);
final Map envirOnment= getEnvironment(client, host);
final Map labels = getLabels(client, host);

代码示例来源:origin: at.molindo/helios-services

final Job job = getJob(id);
verifyToken(token, job);
final String taskCreatiOnPath= Paths.configHostJobCreation(host, id, operationId);
final List staticPorts = staticPorts(job);
final Map portNodes = Maps.newHashMap();
final byte[] idJson = id.toJsonBytes();
} catch (NoNodeException e) {
assertJobExists(client, id);
assertHostExists(client, host);
deployJobRetry(client, host, deployment, count + 1, token);
} catch (NodeExistsException e) {

代码示例来源:origin: at.molindo/helios-services

final ZooKeeperClient client = provider.get("getJobStatus");
final Job job = getJob(client, jobId);
if (job == null) {
return null;
hosts = listJobHosts(client, jobId);
} catch (JobDoesNotExistException e) {
return null;
final ImmutableMap.Builder taskStatuses = ImmutableMap.builder();
for (final String host : hosts) {
final TaskStatus taskStatus = getTaskStatus(client, host, jobId);
if (taskStatus != null) {
taskStatuses.put(host, taskStatus);
final Deployment deployment = getDeployment(host, jobId);
if (deployment != null) {
deployments.put(host, deployment);

代码示例来源:origin: at.molindo/helios-services

/**
* Creates a config entry within the specified agent to un/deploy a job, or more generally, change
* the deployment status according to the {@code Goal} value in {@link Deployment}.
*/
@Override
public void deployJob(final String host, final Deployment deployment, final String token)
throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException,
JobPortAllocationConflictException, TokenVerificationException {
final ZooKeeperClient client = provider.get("deployJob");
deployJobRetry(client, host, deployment, 0, token);
}

代码示例来源:origin: at.molindo/helios-services

@Override
public void deployJob(String host, Deployment job)
throws HostNotFoundException, JobAlreadyDeployedException, JobDoesNotExistException,
JobPortAllocationConflictException {
try {
deployJob(host, job, Job.EMPTY_TOKEN);
} catch (TokenVerificationException e) {
throw Throwables.propagate(e);
}
}

推荐阅读
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 本文介绍了brain的意思、读音、翻译、用法、发音、词组、同反义词等内容,以及脑新东方在线英语词典的相关信息。还包括了brain的词汇搭配、形容词和名词的用法,以及与brain相关的短语和词组。此外,还介绍了与brain相关的医学术语和智囊团等相关内容。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 使用圣杯布局模式实现网站首页的内容布局
    本文介绍了使用圣杯布局模式实现网站首页的内容布局的方法,包括HTML部分代码和实例。同时还提供了公司新闻、最新产品、关于我们、联系我们等页面的布局示例。商品展示区包括了车里子和农家生态土鸡蛋等产品的价格信息。 ... [详细]
author-avatar
888真人游戏官网1
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有