Java Code Examples for org.apache.hadoop.yarn.api.records.ApplicationReport#getStartTime()

The following examples show how to use org.apache.hadoop.yarn.api.records.ApplicationReport#getStartTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppInfo.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public AppInfo(ApplicationReport app) {
  appId = app.getApplicationId().toString();
  if (app.getCurrentApplicationAttemptId() != null) {
    currentAppAttemptId = app.getCurrentApplicationAttemptId().toString();
  }
  user = app.getUser();
  queue = app.getQueue();
  name = app.getName();
  type = app.getApplicationType();
  host = app.getHost();
  rpcPort = app.getRpcPort();
  appState = app.getYarnApplicationState();
  diagnosticsInfo = app.getDiagnostics();
  trackingUrl = app.getTrackingUrl();
  originalTrackingUrl = app.getOriginalTrackingUrl();
  submittedTime = app.getStartTime();
  startedTime = app.getStartTime();
  finishedTime = app.getFinishTime();
  elapsedTime = Times.elapsed(startedTime, finishedTime);
  finalAppStatus = app.getFinalApplicationStatus();
  progress = app.getProgress() * 100; // in percent
  if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
    this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
  }
}
 
Example 2
Source File: AppInfo.java    From big-c with Apache License 2.0 6 votes vote down vote up
public AppInfo(ApplicationReport app) {
  appId = app.getApplicationId().toString();
  if (app.getCurrentApplicationAttemptId() != null) {
    currentAppAttemptId = app.getCurrentApplicationAttemptId().toString();
  }
  user = app.getUser();
  queue = app.getQueue();
  name = app.getName();
  type = app.getApplicationType();
  host = app.getHost();
  rpcPort = app.getRpcPort();
  appState = app.getYarnApplicationState();
  diagnosticsInfo = app.getDiagnostics();
  trackingUrl = app.getTrackingUrl();
  originalTrackingUrl = app.getOriginalTrackingUrl();
  submittedTime = app.getStartTime();
  startedTime = app.getStartTime();
  finishedTime = app.getFinishTime();
  elapsedTime = Times.elapsed(startedTime, finishedTime);
  finalAppStatus = app.getFinalApplicationStatus();
  progress = app.getProgress() * 100; // in percent
  if (app.getApplicationTags() != null && !app.getApplicationTags().isEmpty()) {
    this.applicationTags = CSV_JOINER.join(app.getApplicationTags());
  }
}
 
Example 3
Source File: ClusterAnalysisMetrics.java    From jumbune with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Gets the long running applications.
 * This method returns IDs of all the yarn applications which have been running for a long period of time 
 * depending upon the threshold time period given by the user. 
 *
 * @param durationMillis the duration millis
 * @param cluster 
 * @param rmCommunicator 
 * @return the long running applications
 */
public List<Map<String, Object>> getLongRunningApplications(
		final long durationMillis, Cluster cluster, RMCommunicator rmCommunicator) 
			throws YarnException, IOException {
	List<Map<String, Object>> appReports = new ArrayList<Map<String, Object>>(5);
	Map<String, Object> attribMap = null;
	long appDuration;
	long endMillis = RemotingUtil.getHadoopClusterTimeMillis(cluster);
	for (ApplicationReport report : rmCommunicator.getRunningApplications()) {
		appDuration = (endMillis - report.getStartTime());
		if (appDuration > durationMillis) {
			attribMap = new HashMap<>(5);
			attribMap.put(APPLICATION_ID, report.getApplicationId().toString());
			attribMap.put(DURATION_MILLIS, appDuration);
			attribMap.put(USER, report.getUser());
			attribMap.put(QUEUE, report.getQueue());
			attribMap.put(APP_TYPE, report.getApplicationType());
			appReports.add(attribMap);
		}
	}
	return appReports;
}
 
Example 4
Source File: YarnService.java    From varOne with MIT License 5 votes vote down vote up
public List<String> getSparkApplicationsByPeriod(long start, long end) throws YarnException, IOException {
	List<String> applicationIds = new ArrayList<String>();
	for(ApplicationReport report : this.yarnClient.getApplications()){
		if(report.getApplicationType().equals("SPARK")){
			if((start <= report.getStartTime() && report.getStartTime() <= end) || 
					(start <= report.getFinishTime() && report.getFinishTime() <= end)){
				applicationIds.add(report.getApplicationId().toString());
			}
		}
	}
	return applicationIds;
}
 
Example 5
Source File: ClusterAnalysisMetrics.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Map<String, Long> getJobsDuration(RMCommunicator rmCommunicator) throws YarnException, IOException {

		long appDuration, endMillis = 0;
		Map<String, Long> jobsDuration = new HashMap<String, Long>();
		for (ApplicationReport report : rmCommunicator.getApplications()) {
			if (report.getFinalApplicationStatus().equals(FinalApplicationStatus.SUCCEEDED)) {
				endMillis = report.getFinishTime();
				appDuration = (endMillis - report.getStartTime());
				jobsDuration.put(report.getApplicationId().toString().replace(APPLICATION, JOB), appDuration);
			}
		}	
		return jobsDuration;
	}
 
Example 6
Source File: ClusterAnalysisMetrics.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
private boolean isThresholdExceeded(ApplicationReport report, List<SlaConf> slaConfList, long currentServerTime) {
	String user = report.getUser();
	for (SlaConf slaConf : slaConfList) {
		if (slaConf.getUser().equals(user)) {
			if ( (currentServerTime - report.getStartTime()) > (slaConf.getMaximumDuration() * 60000)) {
				return true;
			}
		}
	}
	return false;
}
 
Example 7
Source File: SchedulerApplication.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
public SchedulerApplication(ApplicationReport appReport, Priority priority) {
    applicationId = appReport.getApplicationId();
    startTime = appReport.getStartTime();
    this.priority = priority;
}