com.spotify.helios.master.ZooKeeperMasterModel.getUndeployOperations()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(111)

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

ZooKeeperMasterModel.getUndeployOperations介绍

暂无

代码示例

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

private RollingUpdateOp rollingUpdateUndeploy(final ZooKeeperClient client,
                       final RollingUpdateOpFactory opFactory,
                       final DeploymentGroup deploymentGroup,
                       final String host,
                       final boolean skipRedundantUndeploys) {
 final List<ZooKeeperOperation> operations = Lists.newArrayList();
 for (final Deployment deployment : getTasks(client, host).values()) {
  if (!ownedByDeploymentGroup(deployment, deploymentGroup)
    && !isMigration(deployment, deploymentGroup)) {
   continue;
  }
  if (skipRedundantUndeploys && redundantUndeployment(deployment, deploymentGroup)) {
   continue;
  }
  try {
   final String token = MoreObjects.firstNonNull(
     deploymentGroup.getRolloutOptions().getToken(), Job.EMPTY_TOKEN);
   operations.addAll(getUndeployOperations(client, host, deployment.getJobId(), token));
   log.debug("planned undeploy operations for job={}", deployment.getJobId());
  } 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 (JobNotDeployedException e) {
   // probably somebody beat us to the punch of undeploying. that's fine.
  }
 }
 return opFactory.nextTask(operations);
}

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

private RollingUpdateTaskResult rollingUpdateUndeploy(final DeploymentGroup deploymentGroup,
                           final String host) {
 final ZooKeeperClient client = provider.get("rollingUpdateUndeploy");
 final List<ZooKeeperOperation> operations = Lists.newArrayList();
 for (final Deployment deployment : getTasks(client, host).values()) {
  final boolean isOwnedByDeploymentGroup = Objects.equals(
    deployment.getDeploymentGroupName(), deploymentGroup.getName());
  final boolean isSameJob = deployment.getJobId().equals(deploymentGroup.getJobId());
  if (isOwnedByDeploymentGroup || (
    isSameJob && deploymentGroup.getRolloutOptions().getMigrate())) {
   if (isSameJob && isOwnedByDeploymentGroup && deployment.getGoal().equals(Goal.START)) {
    // The job we want deployed is already deployed and set to run, so just leave it.
    continue;
   }
   try {
    operations.addAll(getUndeployOperations(client, host, deployment.getJobId(),
                        Job.EMPTY_TOKEN));
   } catch (TokenVerificationException | HostNotFoundException e) {
    return RollingUpdateTaskResult.error(e, host);
   } catch (JobNotDeployedException e) {
    // probably somebody beat us to the punch of undeploying. that's fine.
   }
  }
 }
 return RollingUpdateTaskResult.of(operations);
}

相关文章