Source:
<code>public void rollingUpdate(final DeploymentGroup deploymentGroup, final JobId jobId, final RolloutOptions options) throws DeploymentGroupDoesNotExistException, JobDoesNotExistException { checkNotNull(deploymentGroup, "deploymentGroup"); log.info("preparing to initiate rolling-update on deployment-group: name={}, jobId={}", deploymentGroup.getName(), jobId); if (getJob(jobId) == null) { throw new JobDoesNotExistException(jobId); } final RollingOperation rolling = RollingOperation.newBuilder() .setDeploymentGroupName(deploymentGroup.getName()) .setJobId(jobId) .setRolloutOptions(options) <START> .build(); <END> final RollingOperationStatus status = RollingOperationStatus.newBuilder() .setState(NEW) .build(); final List<ZooKeeperOperation> operations = Lists.newArrayList(); final ZooKeeperClient client = provider.get("rollingUpdate"); try { if (client.exists(Paths.configDeploymentGroup(deploymentGroup.getName())) == null) { throw new DeploymentGroupDoesNotExistException(deploymentGroup.getName()); } client.ensurePath(Paths.configRollingOps()); client.ensurePath(Paths.statusRollingOps()); operations.add(create(Paths.configRollingOp(rolling.getId()), rolling)); operations.add(create(Paths.statusRollingOp(rolling.getId()), status)); prependRollingOperation(client, operations, deploymentGroup.getName(), rolling.getId()); final RollingUpdateOp op = getInitRollingUpdateOps(deploymentGroup, rolling, client); operations.addAll(op.operations()); log.info("starting zookeeper transaction for rolling-update on " + "deployment-group name={} jobId={}. List of operations: {}", deploymentGroup.getName(), jobId, operations); client.transaction(operations); emitEvents(ROLLING_OPERATION_EVENTS_KAFKA_TOPIC, op.events()); log.info("initiated rolling-update on deployment-group: name={}, jobId={}", rolling.getId(), deploymentGroup.getName(), jobId); } catch (final KeeperException e) { throw new HeliosRuntimeException( "rolling-update " + rolling.getId() + " on deployment-group " + deploymentGroup.getName() + " failed", e); } }</code><technical_language>set reason</technical_language>

Target:
public void rollingUpdate(final DeploymentGroup deploymentGroup, final JobId jobId, final RolloutOptions options) throws DeploymentGroupDoesNotExistException, JobDoesNotExistException { checkNotNull(deploymentGroup, "deploymentGroup"); log.info("preparing to initiate rolling-update on deployment-group: name={}, jobId={}", deploymentGroup.getName(), jobId); if (getJob(jobId) == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("rollingUpdate"); final RollingOperation lastOp = getLastRollingOperation(client, deploymentGroup.getName()); if (rollingOpInProgress(client, lastOp)) { if (lastOp.getJobId().equals(jobId)) { log.info("duplicate rolling-operation requested for deployment group {}. " + "{} is already being deployed by rolling-operation {}", deploymentGroup.getName(), jobId, lastOp.getId()); return; } try { log.info("rolling-operation requested to deploy to deployment group " + "aborting running rolling-operation of {}", jobId, deploymentGroup.getName(), lastOp.getId(), lastOp.getJobId()); stopRollingOperation(client, lastOp.getId(), "Aborted by subsequent rolling update."); } catch (final RollingOperationDoesNotExistException e) { log.debug("tried to stop rolling-operation due to a subsequent rolling-operation " + "on deployment group {}, but it was removed.", lastOp.getId(), deploymentGroup.getName(), e); } } final RollingOperation rolling = RollingOperation.newBuilder() .setDeploymentGroupName(deploymentGroup.getName()) .setJobId(jobId) .setRolloutOptions(options) .setReason(MANUAL) .build(); final RollingUpdateOp ops = generateOps(client, rolling); try { log.info("starting zookeeper transaction for rolling-operation on deployment-group: " + "name={}, jobId={}", rolling.getId(), deploymentGroup.getName(), jobId); client.transaction(ops.operations()); emitEvents(ROLLING_OPERATION_EVENTS_KAFKA_TOPIC, ops.events()); } catch (final KeeperException e) { throw new HeliosRuntimeException( "rolling-operation " + rolling.getId() + " on deployment-group " + deploymentGroup.getName() + " failed", e); } }