/** * Always run the GenerateCanaryAnalysisResultStage. */ private void addAlwaysRunResultStage(@Nonnull Stage parent, @Nonnull StageGraphBuilder graph) { graph.append(stage -> { stage.setType(GenerateCanaryAnalysisResultStage.STAGE_TYPE); stage.setName(GenerateCanaryAnalysisResultStage.STAGE_DESCRIPTION); stage.setContext(parent.getContext()); }); }
stage.setType(WaitStage.STAGE_TYPE); stage.setName("Warmup Wait"); stage.getContext().put("waitTime", canaryAnalysisExecutionRequest.getBeginCanaryAnalysisAfterAsDuration().getSeconds()); stage.setType(WaitStage.STAGE_TYPE); stage.setName("Interval Wait #" + index); stage.getContext().put("waitTime", analysisInterval.getSeconds()); stage.setType(RunCanaryStage.STAGE_TYPE); stage.setName(RunCanaryStage.STAGE_NAME_PREFIX + index); stage.getContext().putAll(kayentaObjectMapper.convertValue(runCanaryContext,
/** * Always run the GenerateCanaryAnalysisResultStage. */ private void addAlwaysRunResultStage(@Nonnull Stage parent, @Nonnull StageGraphBuilder graph) { graph.append(stage -> { stage.setType(GenerateCanaryAnalysisResultStage.STAGE_TYPE); stage.setName(GenerateCanaryAnalysisResultStage.STAGE_DESCRIPTION); stage.setContext(parent.getContext()); }); }
@Override public void addAdditionalBeforeStages( @Nonnull Stage parent, @Nonnull StageGraphBuilder graph ) { if (Objects.equals(parent.getContext().get("allowDeleteActive"), true)) { Map<String, Object> context = new HashMap<>(parent.getContext()); context.put("remainingEnabledServerGroups", parent.getContext().get("shrinkToSize")); context.put("preferLargerOverNewer", parent.getContext().get("retainLargerOverNewer")); context.put("continueIfClusterNotFound", Objects.equals(parent.getContext().get("shrinkToSize"), 0)); // We don't want the key propagated if interestingHealthProviderNames isn't defined, since this prevents // health providers from the stage's 'determineHealthProviders' task to be added to the context. if (parent.getContext().get("interestingHealthProviderNames") != null) { context.put("interestingHealthProviderNames", parent.getContext().get("interestingHealthProviderNames")); } graph.add((it) -> { it.setType(disableClusterStage.getType()); it.setName("disableCluster"); it.setContext(context); }); } } }
if (addLocking) { graph.append(stage -> { stage.setType(AcquireLockStage.PIPELINE_TYPE); stage.getContext().put("lock", Collections.singletonMap("lockName", lockName)); }); it.setType(RollbackServerGroupStage.PIPELINE_CONFIG_TYPE); it.setName("Rollback " + region); it.setContext(context); stage.setType(ReleaseLockStage.PIPELINE_TYPE); stage.getContext().put("lock", Collections.singletonMap("lockName", lockName)); }); it.setType(WaitStage.STAGE_TYPE); it.setName("Wait after " + region); it.setContext(Collections.singletonMap("waitTime", stageData.waitTimeBetweenRegions));
stage.setId(stageId); stage.setRefId(map.get(prefix + "refId")); stage.setType(map.get(prefix + "type")); stage.setName(map.get(prefix + "name")); stage.setStartTime(NumberUtils.createLong(map.get(prefix + "startTime")));
@Override public final void beforeStages(@Nonnull Stage parent, @Nonnull StageGraphBuilder graph) { if (lockingConfigurationProperties.isEnabled()) { List<Location> locations = locationsFromStage(parent.getContext()); ClusterSelection clusterSelection = parent.mapTo(ClusterSelection.class); for (Location location : locations) { String lockName = ClusterLockHelper.clusterLockName( clusterSelection.getMoniker(), clusterSelection.getCredentials(), location); if (trafficGuard.hasDisableLock(clusterSelection.getMoniker(), clusterSelection.getCredentials(), location)) { graph.add(stage -> { stage.setType(AcquireLockStage.PIPELINE_TYPE); stage.getContext().put("lock", Collections.singletonMap("lockName", lockName)); }); } } } addAdditionalBeforeStages(parent, graph); }
@Override public final void afterStages(@Nonnull Stage parent, @Nonnull StageGraphBuilder graph) { addAdditionalAfterStages(parent, graph); if (lockingConfigurationProperties.isEnabled()) { List<Location> locations = locationsFromStage(parent.getContext()); ClusterSelection clusterSelection = parent.mapTo(ClusterSelection.class); for (Location location : locations) { String lockName = ClusterLockHelper.clusterLockName( clusterSelection.getMoniker(), clusterSelection.getCredentials(), location); if (trafficGuard.hasDisableLock(clusterSelection.getMoniker(), clusterSelection.getCredentials(), location)) { graph.append(stage -> { stage.setType(ReleaseLockStage.PIPELINE_TYPE); stage.getContext().put("lock", Collections.singletonMap("lockName", lockName)); }); } } } }
stage.setType(WaitStage.STAGE_TYPE); stage.setName("Warmup Wait"); stage.getContext().put("waitTime", canaryAnalysisExecutionRequest.getBeginCanaryAnalysisAfterAsDuration().getSeconds()); stage.setType(WaitStage.STAGE_TYPE); stage.setName("Interval Wait #" + index); stage.getContext().put("waitTime", analysisInterval.getSeconds()); stage.setType(RunCanaryStage.STAGE_TYPE); stage.setName(RunCanaryStage.STAGE_NAME_PREFIX + index); stage.getContext().putAll(kayentaObjectMapper.convertValue(runCanaryContext,