/** * Don't advance to the next task -- yield and have the current task be executed again in the * next iteration. * * @return {@link RollingUpdateOp} */ public RollingUpdateOp yield() { // Do nothing return new RollingUpdateOp(ImmutableList.<ZooKeeperOperation>of(), ImmutableList.<Map<String, Object>>of()); }
client, opFactory, task, tasks.getDeploymentGroup()); if (!op.operations().isEmpty()) { final List<ZooKeeperOperation> ops = Lists.newArrayList(); ops.add(check(Paths.statusDeploymentGroupTasks(deploymentGroupName), versionedTasks.version())); ops.addAll(op.operations()); emitEvents(deploymentGroupEventTopic, op.events()); } catch (BadVersionException e) {
operations.addAll(op.operations()); emitEvents(deploymentGroupEventTopic, op.events()); log.info("initiated rolling-update on deployment-group: name={}, jobId={}", deploymentGroup.getName(), jobId);
ops.addAll(op.operations()); events = op.events();
deploymentGroup.getName(), errMsg); return new RollingUpdateOp(ImmutableList.copyOf(operations), ImmutableList.copyOf(events));
public RollingUpdateOp nextTask(final List<ZooKeeperOperation> operations) { final List<ZooKeeperOperation> ops = Lists.newArrayList(operations); final List<Map<String, Object>> events = Lists.newArrayList(); final RolloutTask task = tasks.getRolloutTasks().get(tasks.getTaskIndex()); // Update the task index, delete tasks if done if (tasks.getTaskIndex() + 1 == tasks.getRolloutTasks().size()) { final DeploymentGroupStatus status = DeploymentGroupStatus.newBuilder() .setState(DONE) .build(); // We are done -> delete tasks & update status ops.add(delete(Paths.statusDeploymentGroupTasks(deploymentGroup.getName()))); ops.add(set(Paths.statusDeploymentGroup(deploymentGroup.getName()), status)); // Emit an event signalling that we're DONE! events.add(eventFactory.rollingUpdateDone(deploymentGroup)); } else { ops.add( set(Paths.statusDeploymentGroupTasks(deploymentGroup.getName()), tasks.toBuilder() .setTaskIndex(tasks.getTaskIndex() + 1) .build())); // Only emit an event if the task resulted in taking in action. If there are no ZK operations // the task was effectively a no-op. if (!operations.isEmpty()) { events.add(eventFactory.rollingUpdateTaskSucceeded(deploymentGroup, task)); } } return new RollingUpdateOp(ImmutableList.copyOf(ops), ImmutableList.copyOf(events)); }
return new RollingUpdateOp(ImmutableList.copyOf(ops), ImmutableList.copyOf(events));