com.netflix.spinnaker.orca.pipeline.model.Stage.getRefId()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(12.3k)|赞(0)|评价(0)|浏览(128)

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

Stage.getRefId介绍

暂无

代码示例

代码示例来源:origin: spinnaker/kayenta

private List<String> getMetricSetListIds(Execution execution, String stagePrefix) {
 List<Stage> stages = execution.getStages();
 return stages.stream()
  .filter(stage -> {
   String refId = stage.getRefId();
   return refId != null && refId.startsWith(stagePrefix);
  })
  .map(stage -> resolveMetricSetListId(stage))
  .collect(Collectors.toList());
}

代码示例来源:origin: spinnaker/kayenta

public CanaryConfig getCanaryConfig(Execution pipeline) {
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + pipeline.getId() + "'"));
 Map<String, Object> context = contextStage.getContext();
 Map<String, Object> canaryConfigMap = (Map<String, Object>)context.get("canaryConfig");
 return objectMapper.convertValue(canaryConfigMap, CanaryConfig.class);
}

代码示例来源:origin: spinnaker/kayenta

public String getCanaryExecutionRequestFromJudgeContext(Execution pipeline) {
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_JUDGE))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_JUDGE + "' in pipeline ID '" + pipeline.getId() + "'"));
 Map<String, Object> context = contextStage.getContext();
 return (String) context.get("canaryExecutionRequest");
}

代码示例来源:origin: spinnaker/kayenta

public CanaryExecutionStatusResponse fromExecution(Execution pipeline) {
 String canaryExecutionId = pipeline.getId();
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + canaryExecutionId + "'"));
 Map<String, Object> contextContext = contextStage.getContext();
 String storageAccountName = (String)contextContext.get("storageAccountName");
 return fromExecution(storageAccountName, pipeline);
}

代码示例来源:origin: spinnaker/kayenta

public CanaryExecutionRequest getCanaryExecutionRequest(Execution pipeline) {
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + pipeline.getId() + "'"));
 Map<String, Object> context = contextStage.getContext();
 String canaryExecutionRequestJSON = (String)context.get("canaryExecutionRequest");
 if (canaryExecutionRequestJSON == null) {
  canaryExecutionRequestJSON = getCanaryExecutionRequestFromJudgeContext(pipeline);
 }
 if (canaryExecutionRequestJSON == null) {
  return null;
 }
 CanaryExecutionRequest canaryExecutionRequest = null;
 try {
  canaryExecutionRequest = objectMapper.readValue(canaryExecutionRequestJSON, CanaryExecutionRequest.class);
 } catch (IOException e) {
  log.error("Cannot deserialize canaryExecutionRequest", e);
  throw new IllegalArgumentException("Cannot deserialize canaryExecutionRequest", e);
 }
 return canaryExecutionRequest;
}

代码示例来源:origin: spinnaker/kayenta

String canaryExecutionId = pipeline.getId();
Stage compareJudgeResultsStage = pipeline.getStages().stream()
 .filter(stage -> stage.getRefId().equals("compareJudgeResults"))
 .findFirst()
 .orElseThrow(() -> new IllegalArgumentException("Unable to find stage 'compareJudgeResults' in pipeline ID '" + canaryExecutionId + "'"));

代码示例来源:origin: spinnaker/kayenta

.filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_JUDGE))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_JUDGE + "' in pipeline ID '" + canaryExecutionId + "'"));
.filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + canaryExecutionId + "'"));
.filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_MIX_METRICS))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_MIX_METRICS + "' in pipeline ID '" + canaryExecutionId + "'"));

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

@Nonnull
public Stage stageByRef(String refId) {
 return stages
  .stream()
  .filter(it -> refId.equals(it.getRefId()))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException(String.format("No stage with refId %s exists", refId)));
}

代码示例来源:origin: com.netflix.kayenta/kayenta-core

public CanaryConfig getCanaryConfig(Execution pipeline) {
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + pipeline.getId() + "'"));
 Map<String, Object> context = contextStage.getContext();
 Map<String, Object> canaryConfigMap = (Map<String, Object>)context.get("canaryConfig");
 return objectMapper.convertValue(canaryConfigMap, CanaryConfig.class);
}

代码示例来源:origin: com.netflix.kayenta/kayenta-core

private List<String> getMetricSetListIds(Execution execution, String stagePrefix) {
 List<Stage> stages = execution.getStages();
 return stages.stream()
  .filter(stage -> {
   String refId = stage.getRefId();
   return refId != null && refId.startsWith(stagePrefix);
  })
  .map(stage -> resolveMetricSetListId(stage))
  .collect(Collectors.toList());
}

代码示例来源:origin: com.netflix.kayenta/kayenta-core

public String getCanaryExecutionRequestFromJudgeContext(Execution pipeline) {
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_JUDGE))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_JUDGE + "' in pipeline ID '" + pipeline.getId() + "'"));
 Map<String, Object> context = contextStage.getContext();
 return (String) context.get("canaryExecutionRequest");
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

@JsonIgnore public List<Stage> downstreamStages() {
 return getExecution()
  .getStages()
  .stream()
  .filter(it -> it.getRequisiteStageRefIds().contains(getRefId()))
  .collect(toList());
}

代码示例来源:origin: com.netflix.kayenta/kayenta-core

public CanaryExecutionStatusResponse fromExecution(Execution pipeline) {
 String canaryExecutionId = pipeline.getId();
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + canaryExecutionId + "'"));
 Map<String, Object> contextContext = contextStage.getContext();
 String storageAccountName = (String)contextContext.get("storageAccountName");
 return fromExecution(storageAccountName, pipeline);
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-clouddriver

@VisibleForTesting
Collection<String> upstreamImageIds(Stage sourceStage, Collection<String> consideredStageRefIds, String cloudProviderType) {
 List<Stage> ancestors = sourceStage.ancestors();
 List<Stage> imageProvidingAncestorStages = ancestors.stream()
  .filter(stage -> {
   String cloudProvider = (String) stage.getContext().getOrDefault("cloudProvider", stage.getContext().get("cloudProviderType"));
   boolean consideredStageRefIdMatches = consideredStageRefIds == null || consideredStageRefIds.isEmpty() || consideredStageRefIds.contains(stage.getRefId()) || (stage.getParent() != null && consideredStageRefIds.contains(stage.getParent().getRefId()));
   return consideredStageRefIdMatches && (stage.getContext().containsKey("imageId") || stage.getContext().containsKey("amiDetails")) && cloudProviderType.equals(cloudProvider);
  }).collect(toList());
 return imageProvidingAncestorStages.stream().map(it -> {
  if (it.getContext().containsKey("imageId")) {
   return (String) it.getContext().get("imageId");
  } else {
   return (String) ((List<Map>) it.getContext().get("amiDetails")).get(0).get("imageId");
  }
 }).collect(toList());
}

代码示例来源:origin: com.netflix.kayenta/kayenta-core

public CanaryExecutionRequest getCanaryExecutionRequest(Execution pipeline) {
 Stage contextStage = pipeline.getStages().stream()
  .filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
  .findFirst()
  .orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + pipeline.getId() + "'"));
 Map<String, Object> context = contextStage.getContext();
 String canaryExecutionRequestJSON = (String)context.get("canaryExecutionRequest");
 if (canaryExecutionRequestJSON == null) {
  canaryExecutionRequestJSON = getCanaryExecutionRequestFromJudgeContext(pipeline);
 }
 if (canaryExecutionRequestJSON == null) {
  return null;
 }
 CanaryExecutionRequest canaryExecutionRequest = null;
 try {
  canaryExecutionRequest = objectMapper.readValue(canaryExecutionRequestJSON, CanaryExecutionRequest.class);
 } catch (IOException e) {
  log.error("Cannot deserialize canaryExecutionRequest", e);
  throw new IllegalArgumentException("Cannot deserialize canaryExecutionRequest", e);
 }
 return canaryExecutionRequest;
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

/**
 * Makes {@code next} depend on {@code previous} via its
 * {@link Stage#requisiteStageRefIds}. If either {@code next} or
 * {@code previous} are not yet present in the graph this method will add them.
 */
public void connect(@Nonnull Stage previous, @Nonnull Stage next) {
 add(previous);
 add(next);
 Set<String> requisiteStageRefIds = new HashSet<>(next.getRequisiteStageRefIds());
 requisiteStageRefIds.add(previous.getRefId());
 next.setRequisiteStageRefIds(requisiteStageRefIds);
 graph.putEdge(previous, next);
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

private String generateRefId() {
 long offset = parent
  .getExecution()
  .getStages()
  .stream()
  .filter(i -> parent.getId().equals(i.getParentStageId()) && type == i.getSyntheticStageOwner())
  .count();
 return format(
  "%s%s%d",
  parent.getRefId(),
  type == STAGE_BEFORE ? "<" : ">",
  offset + graph.nodes().size()
 );
}

代码示例来源:origin: com.netflix.kayenta/kayenta-core

String canaryExecutionId = pipeline.getId();
Stage compareJudgeResultsStage = pipeline.getStages().stream()
 .filter(stage -> stage.getRefId().equals("compareJudgeResults"))
 .findFirst()
 .orElseThrow(() -> new IllegalArgumentException("Unable to find stage 'compareJudgeResults' in pipeline ID '" + canaryExecutionId + "'"));

代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis

protected Map<String, String> serializeStage(Stage stage) {
 String prefix = format("stage.%s.", stage.getId());
 Map<String, String> map = new HashMap<>();
 map.put(prefix + "refId", stage.getRefId());
 map.put(prefix + "type", stage.getType());
 map.put(prefix + "name", stage.getName());

代码示例来源:origin: com.netflix.kayenta/kayenta-core

.filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_JUDGE))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_JUDGE + "' in pipeline ID '" + canaryExecutionId + "'"));
.filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_SET_CONTEXT))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_SET_CONTEXT + "' in pipeline ID '" + canaryExecutionId + "'"));
.filter(stage -> stage.getRefId().equals(CanaryStageNames.REFID_MIX_METRICS))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unable to find stage '" + CanaryStageNames.REFID_MIX_METRICS + "' in pipeline ID '" + canaryExecutionId + "'"));

相关文章