Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Yarn: Application Id - How is it generated ?

avatar

I want to understand how the applicationId is generated when a job is submitted to Yarn.

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Dinesh Chitlangia

Following code might give the idea on what you are looking out for:

https://github.com/apache/hadoop/blob/release-2.8.0-RC0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-...

/**
 * <p><code>ApplicationId</code> represents the <em>globally unique</em> 
 * identifier for an application.</p>
 * 
 * <p>The globally unique nature of the identifier is achieved by using the 
 * <em>cluster timestamp</em> i.e. start-time of the 
 * <code>ResourceManager</code> along with a monotonically increasing counter
 * for the application.</p>
 */

  @Public
  @Unstable
  public static ApplicationId newInstance(long clusterTimestamp, int id) {
    ApplicationId appId = Records.newRecord(ApplicationId.class);
    appId.setClusterTimestamp(clusterTimestamp);
    appId.setId(id);
    appId.build();
    return appId;
  }

.

According to the API, The ApplicationId represents the globally unique identifier for an application. The globally unique nature of the identifier is achieved by using the "cluster timestamp" i.e. The start-time of the "ResourceManager<"/code>" along with a monotonically increasing counter for the application.

https://github.com/apache/hadoop/blob/release-2.8.0-RC0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-...

.

View solution in original post

4 REPLIES 4

avatar

Application IDs are provided by Resource Manager to the client through the ApplicationSubmissionContext. More information can be found here:

https://hadoop.apache.org/docs/r2.7.2/hadoop-yarn/hadoop-yarn-site/WritingYarnApplications.html

avatar

Thank you Deepesh.

avatar
Master Mentor

@Dinesh Chitlangia

Following code might give the idea on what you are looking out for:

https://github.com/apache/hadoop/blob/release-2.8.0-RC0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-...

/**
 * <p><code>ApplicationId</code> represents the <em>globally unique</em> 
 * identifier for an application.</p>
 * 
 * <p>The globally unique nature of the identifier is achieved by using the 
 * <em>cluster timestamp</em> i.e. start-time of the 
 * <code>ResourceManager</code> along with a monotonically increasing counter
 * for the application.</p>
 */

  @Public
  @Unstable
  public static ApplicationId newInstance(long clusterTimestamp, int id) {
    ApplicationId appId = Records.newRecord(ApplicationId.class);
    appId.setClusterTimestamp(clusterTimestamp);
    appId.setId(id);
    appId.build();
    return appId;
  }

.

According to the API, The ApplicationId represents the globally unique identifier for an application. The globally unique nature of the identifier is achieved by using the "cluster timestamp" i.e. The start-time of the "ResourceManager<"/code>" along with a monotonically increasing counter for the application.

https://github.com/apache/hadoop/blob/release-2.8.0-RC0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-...

.

avatar

Perfect. Thank you.