org.apache.hadoop.yarn.api.records.ApplicationReport Maven / Gradle / Ivy
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* ApplicationReport
is a report of an application.
*
* It includes details such as:
*
* - {@link ApplicationId} of the application.
* - Applications user.
* - Application queue.
* - Application name.
* - Host on which the
ApplicationMaster
is running.
* - RPC port of the
ApplicationMaster
.
* - Tracking URL.
* - {@link YarnApplicationState} of the application.
* - Diagnostic information in case of errors.
* - Start time of the application.
* - Client {@link Token} of the application (if security is enabled).
*
*
*
* @see ApplicationClientProtocol#getApplicationReport(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest)
*/
@Public
@Stable
public abstract class ApplicationReport {
@Private
@Unstable
public static ApplicationReport newInstance(ApplicationId applicationId,
ApplicationAttemptId applicationAttemptId, String user, String queue,
String name, String host, int rpcPort, Token clientToAMToken,
YarnApplicationState state, String diagnostics, String url,
long startTime, long finishTime, FinalApplicationStatus finalStatus,
ApplicationResourceUsageReport appResources, String origTrackingUrl,
float progress, String applicationType, Token amRmToken) {
ApplicationReport report = Records.newRecord(ApplicationReport.class);
report.setApplicationId(applicationId);
report.setCurrentApplicationAttemptId(applicationAttemptId);
report.setUser(user);
report.setQueue(queue);
report.setName(name);
report.setHost(host);
report.setRpcPort(rpcPort);
report.setClientToAMToken(clientToAMToken);
report.setYarnApplicationState(state);
report.setDiagnostics(diagnostics);
report.setTrackingUrl(url);
report.setStartTime(startTime);
report.setFinishTime(finishTime);
report.setFinalApplicationStatus(finalStatus);
report.setApplicationResourceUsageReport(appResources);
report.setOriginalTrackingUrl(origTrackingUrl);
report.setProgress(progress);
report.setApplicationType(applicationType);
report.setAMRMToken(amRmToken);
return report;
}
/**
* Get the ApplicationId
of the application.
* @return ApplicationId
of the application
*/
@Public
@Stable
public abstract ApplicationId getApplicationId();
@Private
@Unstable
public abstract void setApplicationId(ApplicationId applicationId);
/**
* Get the ApplicationAttemptId
of the current
* attempt of the application
* @return ApplicationAttemptId
of the attempt
*/
@Public
@Stable
public abstract ApplicationAttemptId getCurrentApplicationAttemptId();
@Private
@Unstable
public abstract void setCurrentApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
/**
* Get the user who submitted the application.
* @return user who submitted the application
*/
@Public
@Stable
public abstract String getUser();
@Private
@Unstable
public abstract void setUser(String user);
/**
* Get the queue to which the application was submitted.
* @return queue to which the application was submitted
*/
@Public
@Stable
public abstract String getQueue();
@Private
@Unstable
public abstract void setQueue(String queue);
/**
* Get the user-defined name of the application.
* @return name of the application
*/
@Public
@Stable
public abstract String getName();
@Private
@Unstable
public abstract void setName(String name);
/**
* Get the host on which the ApplicationMaster
* is running.
* @return host on which the ApplicationMaster
* is running
*/
@Public
@Stable
public abstract String getHost();
@Private
@Unstable
public abstract void setHost(String host);
/**
* Get the RPC port of the ApplicationMaster
.
* @return RPC port of the ApplicationMaster
*/
@Public
@Stable
public abstract int getRpcPort();
@Private
@Unstable
public abstract void setRpcPort(int rpcPort);
/**
* Get the client token for communicating with the
* ApplicationMaster
.
*
* ClientToAMToken is the security token used by the AMs to verify
* authenticity of any client
.
*
*
*
* The ResourceManager
, provides a secure token (via
* {@link ApplicationReport#getClientToAMToken()}) which is verified by the
* ApplicationMaster when the client directly talks to an AM.
*
* @return client token for communicating with the
* ApplicationMaster
*/
@Public
@Stable
public abstract Token getClientToAMToken();
@Private
@Unstable
public abstract void setClientToAMToken(Token clientToAMToken);
/**
* Get the YarnApplicationState
of the application.
* @return YarnApplicationState
of the application
*/
@Public
@Stable
public abstract YarnApplicationState getYarnApplicationState();
@Private
@Unstable
public abstract void setYarnApplicationState(YarnApplicationState state);
/**
* Get the diagnositic information of the application in case of
* errors.
* @return diagnositic information of the application in case
* of errors
*/
@Public
@Stable
public abstract String getDiagnostics();
@Private
@Unstable
public abstract void setDiagnostics(String diagnostics);
/**
* Get the tracking url for the application.
* @return tracking url for the application
*/
@Public
@Stable
public abstract String getTrackingUrl();
@Private
@Unstable
public abstract void setTrackingUrl(String url);
/**
* Get the original not-proxied tracking url for the application.
* This is intended to only be used by the proxy itself.
* @return the original not-proxied tracking url for the application
*/
@Private
@Unstable
public abstract String getOriginalTrackingUrl();
@Private
@Unstable
public abstract void setOriginalTrackingUrl(String url);
/**
* Get the start time of the application.
* @return start time of the application
*/
@Public
@Stable
public abstract long getStartTime();
@Private
@Unstable
public abstract void setStartTime(long startTime);
/**
* Get the finish time of the application.
* @return finish time of the application
*/
@Public
@Stable
public abstract long getFinishTime();
@Private
@Unstable
public abstract void setFinishTime(long finishTime);
/**
* Get the final finish status of the application.
* @return final finish status of the application
*/
@Public
@Stable
public abstract FinalApplicationStatus getFinalApplicationStatus();
@Private
@Unstable
public abstract void setFinalApplicationStatus(FinalApplicationStatus finishState);
/**
* Retrieve the structure containing the job resources for this application
* @return the job resources structure for this application
*/
@Public
@Stable
public abstract ApplicationResourceUsageReport getApplicationResourceUsageReport();
/**
* Store the structure containing the job resources for this application
* @param appResources structure for this application
*/
@Private
@Unstable
public abstract void setApplicationResourceUsageReport(ApplicationResourceUsageReport appResources);
/**
* Get the application's progress ( range 0.0 to 1.0 )
* @return application's progress
*/
@Public
@Stable
public abstract float getProgress();
@Private
@Unstable
public abstract void setProgress(float progress);
/**
* Get the application's Type
* @return application's Type
*/
@Public
@Stable
public abstract String getApplicationType();
@Private
@Unstable
public abstract void setApplicationType(String applicationType);
@Private
@Stable
public abstract void setAMRMToken(Token amRmToken);
/**
* Get the AMRM token of the application.
*
* The AMRM token is required for AM to RM scheduling operations. For
* managed Application Masters Yarn takes care of injecting it. For unmanaged
* Applications Masters, the token must be obtained via this method and set
* in the {@link org.apache.hadoop.security.UserGroupInformation} of the
* current user.
*
* The AMRM token will be returned only if all the following conditions are
* met:
*
* the requester is the owner of the ApplicationMaster
* the application master is an unmanaged ApplicationMaster
* the application master is in ACCEPTED state
*
* Else this method returns NULL.
*
* @return the AM to RM token if available.
*/
@Public
@Stable
public abstract Token getAMRMToken();
}