当前位置: 首页>>代码示例>>Java>>正文


Java EventType.PRIORITY_CHANGED属性代码示例

本文整理汇总了Java中org.apache.hadoop.mapred.JobStatusChangeEvent.EventType.PRIORITY_CHANGED属性的典型用法代码示例。如果您正苦于以下问题:Java EventType.PRIORITY_CHANGED属性的具体用法?Java EventType.PRIORITY_CHANGED怎么用?Java EventType.PRIORITY_CHANGED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.mapred.JobStatusChangeEvent.EventType的用法示例。


在下文中一共展示了EventType.PRIORITY_CHANGED属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jobUpdated

@Override
public synchronized void jobUpdated(JobChangeEvent event) {
  JobInProgress job = event.getJobInProgress();
  if (event instanceof JobStatusChangeEvent) {
    // Check if the ordering of the job has changed
    // For now priority and start-time can change the job ordering
    JobStatusChangeEvent statusEvent = (JobStatusChangeEvent)event;
    JobSchedulingInfo oldInfo =  
      new JobSchedulingInfo(statusEvent.getOldStatus());
    if (statusEvent.getEventType() == EventType.PRIORITY_CHANGED 
        || statusEvent.getEventType() == EventType.START_TIME_CHANGED) {
      // Make a priority change
      reorderJobs(job, oldInfo);
    } else if (statusEvent.getEventType() == EventType.RUN_STATE_CHANGED) {
      // Check if the job is complete
      int runState = statusEvent.getNewStatus().getRunState();
      if (runState == JobStatus.SUCCEEDED
          || runState == JobStatus.FAILED
          || runState == JobStatus.KILLED) {
        jobCompleted(oldInfo);
      }
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:JobQueueJobInProgressListener.java

示例2: setJobPriority

/**
 * Change the run-time priority of the given job.
 * 
 * @param jobId job id
 * @param priority new {@link JobPriority} for the job
 * @throws IOException
 * @throws AccessControlException
 */
synchronized void setJobPriority(JobID jobId, JobPriority priority)
    throws AccessControlException, IOException {
  JobInProgress job = jobs.get(jobId);
  if (job != null) {

    // check both queue-level and job-level access
    aclsManager.checkAccess(job, UserGroupInformation.getCurrentUser(),
        Operation.SET_JOB_PRIORITY);

    synchronized (taskScheduler) {
      JobStatus oldStatus = (JobStatus)job.getStatus().clone();
      job.setPriority(priority);
      JobStatus newStatus = (JobStatus)job.getStatus().clone();
      JobStatusChangeEvent event = 
        new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus, 
                                 newStatus);
      updateJobInProgressListeners(event);
    }
  } else {
    LOG.warn("Trying to change the priority of an unknown job: " + jobId);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:30,代码来源:JobTracker.java

示例3: setJobPriority

/**
 * Change the run-time priority of the given job.
 * @param jobId job id
 * @param priority new {@link JobPriority} for the job
 */
synchronized void setJobPriority(JobID jobId, JobPriority priority) {
  JobInProgress job = jobs.get(jobId);
  if (job != null) {
    synchronized (taskScheduler) {
      JobStatus oldStatus = (JobStatus)job.getStatus().clone();
      job.setPriority(priority);
      JobStatus newStatus = (JobStatus)job.getStatus().clone();
      JobStatusChangeEvent event =
        new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus,
                                 newStatus);
      updateJobInProgressListeners(event);
    }
  } else {
    LOG.warn("Trying to change the priority of an unknown job: " + jobId);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:21,代码来源:JobTracker.java

示例4: jobStateChanged

private void jobStateChanged(JobStatusChangeEvent event, QueueInfo qi) {
  JobInProgress job = event.getJobInProgress();
  JobSchedulingInfo oldJobStateInfo = 
    new JobSchedulingInfo(event.getOldStatus());
  // Check if the ordering of the job has changed
  // For now priority and start-time can change the job ordering
  if (event.getEventType() == EventType.PRIORITY_CHANGED 
      || event.getEventType() == EventType.START_TIME_CHANGED) {
    // Make a priority change
    reorderJobs(job, oldJobStateInfo, qi);
  } else if (event.getEventType() == EventType.RUN_STATE_CHANGED) {
    // Check if the job is complete
    int runState = job.getStatus().getRunState();
    if (runState == JobStatus.SUCCEEDED
        || runState == JobStatus.FAILED
        || runState == JobStatus.KILLED) {
      jobCompleted(job, oldJobStateInfo, qi);
    } else if (runState == JobStatus.RUNNING) {
      makeJobRunning(job, oldJobStateInfo, qi);
    }
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:JobQueuesManager.java

示例5: setJobPriority

/**
 * Change the run-time priority of the given job.
 * @param jobId job id
 * @param priority new {@link JobPriority} for the job
 */
synchronized void setJobPriority(JobID jobId, JobPriority priority) {
  JobInProgress job = jobs.get(jobId);
  if (job != null) {
    synchronized (taskScheduler) {
      JobStatus oldStatus = (JobStatus)job.getStatus().clone();
      job.setPriority(priority);
      JobStatus newStatus = (JobStatus)job.getStatus().clone();
      JobStatusChangeEvent event = 
        new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus, 
                                 newStatus);
      updateJobInProgressListeners(event);
    }
  } else {
    LOG.warn("Trying to change the priority of an unknown job: " + jobId);
  }
}
 
开发者ID:koichi626,项目名称:hadoop-gpu,代码行数:21,代码来源:JobTracker.java

示例6: jobStateChanged

private void jobStateChanged(JobStatusChangeEvent event) {
  // Resort the job queue if the job-start-time or job-priority changes
  if (event.getEventType() == EventType.START_TIME_CHANGED
      || event.getEventType() == EventType.PRIORITY_CHANGED) {
    synchronized (jobInitQueue) {
      resortInitQueue();
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:9,代码来源:EagerTaskInitializationListener.java

示例7: setPriority

public void setPriority(FakeJobInProgress fjob, JobPriority priority) {
  // take a snapshot of the status before changing it
  JobStatus oldStatus = (JobStatus)fjob.getStatus().clone();
  fjob.setPriority(priority);
  JobStatus newStatus = (JobStatus)fjob.getStatus().clone();
  JobStatusChangeEvent event = 
    new JobStatusChangeEvent (fjob, EventType.PRIORITY_CHANGED, oldStatus, 
                              newStatus);
  for (JobInProgressListener listener : mylisteners) {
    listener.jobUpdated(event);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:12,代码来源:TestCapacityScheduler.java

示例8: setPriority

public void setPriority(FakeJobInProgress fjob, JobPriority priority) {
  // take a snapshot of the status before changing it
  JobStatus oldStatus = (JobStatus)fjob.getStatus().clone();
  fjob.setPriority(priority);
  JobStatus newStatus = (JobStatus)fjob.getStatus().clone();
  JobStatusChangeEvent event = 
    new JobStatusChangeEvent (fjob, EventType.PRIORITY_CHANGED, oldStatus, 
                              newStatus);
  for (JobInProgressListener listener : listeners) {
    listener.jobUpdated(event);
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:12,代码来源:TestCapacityScheduler.java


注:本文中的org.apache.hadoop.mapred.JobStatusChangeEvent.EventType.PRIORITY_CHANGED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。