示例#1
0
  public JobIdentifier findOriginalJobIdentifier(StageIdentifier stageIdentifier, String jobName) {
    String key = cacheKeyForOriginalJobIdentifier(stageIdentifier, jobName);

    JobIdentifier jobIdentifier = (JobIdentifier) goCache.get(key);

    if (jobIdentifier == null) {
      synchronized (key) {
        jobIdentifier = (JobIdentifier) goCache.get(key);
        if (jobIdentifier == null) {
          Map params =
              arguments("pipelineName", stageIdentifier.getPipelineName())
                  .and("pipelineCounter", stageIdentifier.getPipelineCounter())
                  .and("pipelineLabel", stageIdentifier.getPipelineLabel())
                  .and("stageName", stageIdentifier.getStageName())
                  .and("stageCounter", Integer.parseInt(stageIdentifier.getStageCounter()))
                  .and("jobName", jobName)
                  .asMap();

          jobIdentifier =
              (JobIdentifier) getSqlMapClientTemplate().queryForObject("findJobId", params);

          goCache.put(key, jobIdentifier);
        }
      }
    }

    return cloner.deepClone(jobIdentifier);
  }
 private MaterialRevision materialRevisionForDownstream(
     DependencyMaterial material, Stage upstreamStage) {
   StageIdentifier identifier = upstreamStage.getIdentifier();
   String rev = identifier.getStageLocator();
   String pipelineLabel = identifier.getPipelineLabel();
   return new MaterialRevision(
       material, new Modification(new Date(), rev, pipelineLabel, upstreamStage.getPipelineId()));
 }
示例#3
0
 private String cacheKeyForOriginalJobIdentifier(StageIdentifier stageIdentifier, String jobName) {
   return (getClass().getName()
           + "_originalJobIdentifier_"
           + StringUtil.escapeAndJoinStrings(
               stageIdentifier.getPipelineName(),
               stageIdentifier.getPipelineLabel(),
               String.valueOf(stageIdentifier.getPipelineCounter()),
               stageIdentifier.getStageName(),
               stageIdentifier.getStageCounter())
           + "_job_"
           + jobName.toLowerCase())
       .intern();
 }