コード例 #1
0
 /**
  * Update the available slots for each host if it has been sufficiently long since the last
  * update.
  *
  * @param hosts The hosts to input
  */
 public void updateAllHostAvailSlots(List<HostState> hosts) {
   synchronized (hostAvailSlots) {
     if (JitterClock.globalTime() - lastAvailSlotsUpdate < SPAWN_QUEUE_AVAIL_REFRESH) {
       return;
     }
     hostAvailSlots.clear();
     for (HostState host : hosts) {
       String hostID = host.getHostUuid();
       if (hostID != null) {
         hostAvailSlots.put(hostID, host.getAvailableTaskSlots());
       }
     }
   }
   lastAvailSlotsUpdate = JitterClock.globalTime();
   if (log.isTraceEnabled()) {
     log.trace("[SpawnQueuesByPriority] Host Avail Slots: " + hostAvailSlots);
   }
 }
コード例 #2
0
ファイル: Job.java プロジェクト: hancy2013/hydra
 public Job(String id, String creator) {
   this.id = id;
   this.creator = creator;
   this.createTime = JitterClock.globalTime();
   this.endTime = createTime;
   this.dontAutoBalanceMe = false;
   this.dontDeleteMe = false;
   this.dontCloneMe = false;
   this.config = "";
   this.queryConfig = new JobQueryConfig();
 }
コード例 #3
0
ファイル: Job.java プロジェクト: hancy2013/hydra
 public void setTaskFinished(JobTask task) {
   int preFailErrorCode = task.getPreFailErrorCode();
   int oldErrorCode = task.getErrorCode();
   if (task.getState() == JobTaskState.REPLICATE || task.getState() == JobTaskState.BACKUP) {
     if (preFailErrorCode > 0) {
       // Restore the old job error if it existed
       errorTask(task, preFailErrorCode);
       return;
     }
   }
   task.setErrorCode(0);
   setTaskState(task, JobTaskState.IDLE, true);
   if (getState() == JobState.IDLE) {
     setEndTime(JitterClock.globalTime());
   }
   if (countErrorTasks() == 0 && oldErrorCode == JobTaskErrorCode.EXIT_REPLICATE_FAILURE
       || oldErrorCode == JobTaskErrorCode.EXIT_BACKUP_FAILURE) {
     // If the job is disabled because this task failed to replicate, enable it.
     log.warn("Enabling job " + getId() + " because the last replicate/backup error was resolved");
     disabled = false;
   }
 }