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

x33g5p2x  于2022-01-19 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(125)

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

Execution.getType介绍

暂无

代码示例

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

private void handleStartupFailure(Execution execution, Throwable failure) {
 final String canceledBy = "system";
 final String reason = "Failed on startup: " + failure.getMessage();
 final ExecutionStatus status = ExecutionStatus.TERMINAL;
 log.error("Failed to start {} {}", execution.getType(), execution.getId(), failure);
 executionRepository.updateStatus(execution.getType(), execution.getId(), status);
 executionRepository.cancel(execution.getType(), execution.getId(), canceledBy, reason);
}

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

private void handleStartupFailure(Execution execution, Throwable failure) {
 final String canceledBy = "system";
 final String reason = "Failed on startup: " + failure.getMessage();
 final ExecutionStatus status = ExecutionStatus.TERMINAL;
 log.error("Failed to start {} {}", execution.getType(), execution.getId(), failure);
 executionRepository.updateStatus(execution.getType(), execution.getId(), status);
 executionRepository.cancel(execution.getType(), execution.getId(), canceledBy, reason);
 registry.counter(failureId).increment();
}

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

private void checkRunnable(Execution execution) {
 if (execution.getType() == PIPELINE) {
  pipelineValidator.ifPresent(it -> it.checkRunnable(execution));
 }
}

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

protected String executionKey(Execution execution) {
 return format("%s:%s", execution.getType(), execution.getId());
}

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

private Execution handleStartupFailure(Execution execution, Throwable failure) {
 final String canceledBy = "system";
 final String reason = "Failed on startup: " + failure.getMessage();
 final ExecutionStatus status = ExecutionStatus.TERMINAL;
 log.error("Failed to start {} {}", execution.getType(), execution.getId(), failure);
 executionRepository.updateStatus(execution.getType(), execution.getId(), status);
 executionRepository.cancel(execution.getType(), execution.getId(), canceledBy, reason);
 return executionRepository.retrieve(execution.getType(), execution.getId());
}

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

/**
 * Enriches stage context if it supports strategies
 */
@SuppressWarnings("unchecked")
public void resolveStrategyParams() {
 if (execution.getType() == PIPELINE) {
  Map<String, Object> parameters = Optional.ofNullable(execution.getTrigger()).map(Trigger::getParameters).orElse(emptyMap());
  boolean strategy = false;
  if (parameters.get("strategy") != null) {
   strategy = (boolean) parameters.get("strategy");
  }
  if (strategy) {
   context.put("cloudProvider", parameters.get("cloudProvider"));
   context.put("cluster", parameters.get("cluster"));
   context.put("credentials", parameters.get("credentials"));
   if (parameters.get("region") != null) {
    context.put("regions", singletonList(parameters.get("region")));
   } else if (parameters.get("zone") != null) {
    context.put("zones", singletonList(parameters.get("zone")));
   }
  }
 }
}

代码示例来源:origin: com.netflix.kayenta/kayenta-standalone-canary-analysis

private void handleStartupFailure(Execution execution, Throwable failure) {
 final String canceledBy = "system";
 final String reason = "Failed on startup: " + failure.getMessage();
 final ExecutionStatus status = ExecutionStatus.TERMINAL;
 log.error("Failed to start {} {}", execution.getType(), execution.getId(), failure);
 executionRepository.updateStatus(execution.getType(), execution.getId(), status);
 executionRepository.cancel(execution.getType(), execution.getId(), canceledBy, reason);
}

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

private void handleStartupFailure(Execution execution, Throwable failure) {
 final String canceledBy = "system";
 final String reason = "Failed on startup: " + failure.getMessage();
 final ExecutionStatus status = ExecutionStatus.TERMINAL;
 log.error("Failed to start {} {}", execution.getType(), execution.getId(), failure);
 executionRepository.updateStatus(execution.getType(), execution.getId(), status);
 executionRepository.cancel(execution.getType(), execution.getId(), canceledBy, reason);
 registry.counter(failureId).increment();
}

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

private RedisClientDelegate getRedisDelegate(Execution execution) {
 return getRedisDelegate(execution.getType(), execution.getId());
}

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

public Map<String, Object> buildExecutionContext(Stage stage, boolean includeStageContext) {
 Map<String, Object> augmentedContext = new HashMap<>();
 if (includeStageContext) {
  augmentedContext.putAll(stage.getContext());
 }
 if (stage.getExecution().getType() == PIPELINE) {
  augmentedContext.put("trigger", mapper.convertValue(
    stage.getExecution().getTrigger(),
    new TypeReference<Map<String, Object>>() {})
  );
  augmentedContext.put("execution", stage.getExecution());
 }
 return augmentedContext;
}

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

private String executionKey(Stage stage) {
 return format("%s:%s", stage.getExecution().getType(), stage.getExecution().getId());
}

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

public StageStarted(
 @Nonnull Object source,
 @Nonnull Stage stage
) {
 this(source, stage.getExecution().getType(), stage.getExecution().getId(), stage.getId(), stage.getType(), stage.getName());
}

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

@Override
 public CancellableStage.Result cancel(Stage stage) {
  String readableStageDetails = format("(stageId: %s, executionId: %s, context: %s)", stage.getId(), stage.getExecution().getId(), stage.getContext());
  log.info(format("Cancelling stage %s", readableStageDetails));

  try {
   String executionId = (String) stage.getContext().get("executionId");
   if (executionId != null) {
    if (executionRepository == null) {
     log.error(format("Stage %s could not be canceled w/o front50 enabled. Please set 'front50.enabled: true' in your orca config.", readableStageDetails));
    } else {
     Execution childPipeline = executionRepository.retrieve(PIPELINE, executionId);
     if (!childPipeline.isCanceled()) {
      // flag the child pipeline as canceled (actual cancellation will happen asynchronously)
      executionRepository.cancel(stage.getExecution().getType(), executionId, "parent pipeline", null);
     }
    }
   }
  } catch (Exception e) {
   log.error(format("Failed to cancel stage %s, e: %s", readableStageDetails, e.getMessage()), e);
  }

  return new CancellableStage.Result(stage, emptyMap());
 }
}

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

private Execution checkForCorrelatedExecution(Execution execution) {
 if (execution.getTrigger().getCorrelationId() == null) {
  return null;
 }
 Trigger trigger = execution.getTrigger();
 try {
  Execution o = executionRepository.retrieveByCorrelationId(
   execution.getType(),
   trigger.getCorrelationId()
  );
  log.info("Found pre-existing " + execution.getType() + " by correlation id (id: " +
   o.getId() + ", correlationId: " +
   trigger.getCorrelationId() +
   ")");
  return o;
 } catch (ExecutionNotFoundException e) {
  // Swallow
 }
 return null;
}

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

public StageComplete(
 @Nonnull Object source,
 @Nonnull Stage stage
) {
 this(source, stage.getExecution().getType(), stage.getExecution().getId(), stage.getId(), stage.getType(), stage.getName(), stage.getStatus());
}

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

private RedisClientDelegate getRedisDelegate(Stage stage) {
 return getRedisDelegate(stage.getExecution().getType(), stage.getExecution().getId());
}

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

public TaskStarted(
 @Nonnull Object source,
 @Nonnull Stage stage,
 @Nonnull Task task
) {
 this(
  source,
  stage.getExecution().getType(),
  stage.getExecution().getId(),
  stage.getId(),
  stage.getType(),
  stage.getName(),
  task.getId(),
  task.getImplementingClass(),
  task.getName()
 );
}

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

@Override
public void store(@Nonnull Execution execution) {
 RedisClientDelegate delegate = getRedisDelegate(execution);
 storeExecutionInternal(delegate, execution);
 if (execution.getType() == PIPELINE) {
  delegate.withCommandsClient(c -> {
   c.zadd(executionsByPipelineKey(execution.getPipelineConfigId()),
    execution.getBuildTime() != null ? execution.getBuildTime() : currentTimeMillis(),
    execution.getId()
   );
  });
 }
}

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

public TaskComplete(
 @Nonnull Object source,
 @Nonnull Stage stage,
 @Nonnull Task task
) {
 this(
  source,
  stage.getExecution().getType(),
  stage.getExecution().getId(),
  stage.getId(),
  stage.getType(),
  stage.getName(),
  task.getId(),
  task.getImplementingClass(),
  task.getName(),
  task.getStatus()
 );
}

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

@Override
 public void afterExecution(Persister persister,
               Execution execution,
               ExecutionStatus executionStatus,
               boolean wasSuccessful) {
  if (execution.getType() != ORCHESTRATION) {
   // not concerned with pipelines right now (pipelines can have wait stages / manual judgments which skew execution time)
   return;
  }

  if (execution.getApplication() == null || execution.getStartTime() == null || execution.getEndTime() == null) {
   // should normally have all attributes but a guard just in case
   return;
  }

  Id id = registry
   .createId("executions.totalTime")
   .withTag("executionType", "orchestration")
   .withTag("successful", Boolean.valueOf(wasSuccessful).toString())
   .withTag("application", execution.getApplication().toLowerCase());

  registry.timer(id).record(execution.getEndTime() - execution.getStartTime(), TimeUnit.MILLISECONDS);
 }
}

相关文章