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

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

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

ZooKeeperMasterModel.rollingUpdateUndeploy介绍

[英]rollingUpdateUndeploy is used to undeploy jobs during a rolling update. It enables the 'skipRedundantUndeploys' flag, which enables the redundantDeployment() check.
[中]rollingUpdateUndeploy用于在滚动更新期间取消部署作业。它启用“SkipPredundantUndeploys”标志,该标志启用redundantDeployment()检查。

代码示例

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

/**
 * forceRollingUpdateUndeploy is used to undeploy jobs from hosts that have been removed from the
 * deployment group. It disables the 'skipRedundantUndeploys' flag, which disables the
 * redundantDeployment() check.
 */
private RollingUpdateOp forceRollingUpdateUndeploy(final ZooKeeperClient client,
                          final RollingUpdateOpFactory opFactory,
                          final DeploymentGroup deploymentGroup,
                          final String host) {
 return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, false);
}

代码示例来源: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: spotify/helios

private RollingUpdateOp processRollingUpdateTask(final ZooKeeperClient client,
                         final RollingUpdateOpFactory opFactory,
                         final RolloutTask task,
                         final DeploymentGroup deploymentGroup) {
 final RolloutTask.Action action = task.getAction();
 final String host = task.getTarget();
 switch (action) {
  case UNDEPLOY_OLD_JOBS:
   // add undeploy ops for jobs previously deployed by this deployment group
   return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host);
  case DEPLOY_NEW_JOB:
   // add deploy ops for the new job
   return rollingUpdateDeploy(client, opFactory, deploymentGroup, host);
  case AWAIT_RUNNING:
   return rollingUpdateAwaitRunning(client, opFactory, deploymentGroup, host);
  case FORCE_UNDEPLOY_JOBS:
   return forceRollingUpdateUndeploy(client, opFactory, deploymentGroup, host);
  case AWAIT_UNDEPLOYED:
   return rollingUpdateAwaitUndeployed(client, opFactory, deploymentGroup, host);
  case MARK_UNDEPLOYED:
   return rollingUpdateMarkUndeployed(client, opFactory, deploymentGroup, host);
  default:
   throw new HeliosRuntimeException(String.format(
     "unknown rollout task type %s for deployment group %s.",
     action, deploymentGroup.getName()));
 }
}

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

private RollingUpdateTaskResult getRollingUpdateTaskResult(final RolloutTask task,
                              final DeploymentGroup group) {
 final RollingUpdateTaskResult result;
 if (task == null) {
  // if there is no rollout task, then we're done by definition. this can happen
  // when (for example) there are no hosts in the deployment group
  result = RollingUpdateTaskResult.TASK_COMPLETE;
 } else {
  final String host = task.getTarget();
  final RolloutTask.Action action = task.getAction();
  switch (action) {
   case UNDEPLOY_OLD_JOBS:
    // add undeploy ops for jobs previously deployed by this deployment group
    result = rollingUpdateUndeploy(group, host);
    break;
   case DEPLOY_NEW_JOB:
    // add deploy ops for the new job
    result = rollingUpdateDeploy(group, host);
    break;
   case AWAIT_RUNNING:
    result = rollingUpdateAwaitRunning(group, host);
    break;
   default:
    throw new HeliosRuntimeException(String.format(
      "unknown rollout task type %s for deployment group %s.", action, group.getName()));
  }
 }
 return result;
}

相关文章