private static String formatRolloutOptions(final RolloutOptions options) { if (options == null) { return ""; } final List<String> output = new ArrayList<>(); output.add(String.format("timeout: %d", options.getTimeout())); output.add(String.format("parallelism: %d", options.getParallelism())); output.add(String.format("migrate: %s", options.getMigrate())); output.add(String.format("overlap: %s", options.getOverlap())); output.add(String.format("token: %s", options.getToken())); output.add(String.format("ignoreFailures: %s", options.getIgnoreFailures())); return Joiner.on(", ").join(output); }
private boolean isMigration(final Deployment deployment, final DeploymentGroup deploymentGroup) { return (deploymentGroup.getRolloutOptions() != null && TRUE.equals(deploymentGroup.getRolloutOptions().getMigrate()) && deployment.getJobId().equals(deploymentGroup.getJobId())); }
if (rolloutOptions != null) { out.printf("Rollout options:%n"); out.printf(" Migrate: %s%n", rolloutOptions.getMigrate()); out.printf(" Overlap: %s%n", rolloutOptions.getOverlap()); out.printf(" Parallelism: %d%n", rolloutOptions.getParallelism());
final Boolean actualIgnoreFailures = nullableWithFallback(ignoreFailures, optionsFromJob.getIgnoreFailures()); final Boolean actualMigrate = nullableWithFallback(migrate, optionsFromJob.getMigrate());
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); }