示例#1
0
 public void cancelStage(Stage stage) {
   for (JobInstance job : stage.getJobInstances()) {
     job.cancel();
     jobInstanceDao.updateStateAndResult(job);
   }
   stage.calculateResult();
   updateResultInTransaction(stage, StageResult.Cancelled);
 }
示例#2
0
 public void failStage(Stage stage, Date completionDate) {
   for (JobInstance job : stage.getJobInstances()) {
     job.completing(Failed, completionDate);
     job.completed(completionDate);
     jobInstanceDao.updateStateAndResult(job);
   }
   stage.calculateResult();
   updateResultInTransaction(stage, StageResult.Failed);
 }
示例#3
0
 public StageResult completeAllJobs(Stage stage, JobResult jobResult) {
   for (JobInstance job : stage.getJobInstances()) {
     JobInstanceMother.setBuildingState(job);
     job.setAgentUuid(AGENT_UUID);
     job.completing(jobResult);
     job.completed(new DateTime().plusMinutes(5).toDate());
     jobInstanceDao.updateAssignedInfo(job);
   }
   StageResult stageResult;
   switch (jobResult) {
     case Failed:
       stageResult = StageResult.Failed;
       break;
     case Cancelled:
       stageResult = StageResult.Cancelled;
       break;
     default:
       stageResult = StageResult.Passed;
   }
   stage.calculateResult();
   return stageResult;
 }