Example usage for org.apache.hadoop.yarn.server.api ApplicationInitializationContext getApplicationId

List of usage examples for org.apache.hadoop.yarn.server.api ApplicationInitializationContext getApplicationId

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.server.api ApplicationInitializationContext getApplicationId.

Prototype

public ApplicationId getApplicationId() 

Source Link

Document

Get ApplicationId of the application

Usage

From source file:com.mellanox.hadoop.mapred.UdaShuffleHandler.java

License:Apache License

@Override
public void initializeApplication(ApplicationInitializationContext context) {
    LOG.info("starting initializeApplication of UdaShuffleHandler");

    String user = context.getUser();
    ApplicationId appId = context.getApplicationId();

    JobID jobId = new JobID(Long.toString(appId.getClusterTimestamp()), appId.getId());
    //     rdmaChannel = new UdaPluginSH(conf, user, jobId);     
    rdmaChannel.addJob(user, jobId);//from   w w w. j av a  2s.  c om
    LOG.info("finished initializeApplication of UdaShuffleHandler");
}

From source file:org.apache.spark.network.yarn.YarnShuffleService.java

License:Apache License

@Override
public void initializeApplication(ApplicationInitializationContext context) {
    String appId = context.getApplicationId().toString();
    try {/*  w  ww.ja v a2  s.  c o m*/
        ByteBuffer shuffleSecret = context.getApplicationDataForService();
        if (isAuthenticationEnabled()) {
            AppId fullId = new AppId(appId);
            if (db != null) {
                byte[] key = dbAppKey(fullId);
                byte[] value = mapper.writeValueAsString(shuffleSecret).getBytes(StandardCharsets.UTF_8);
                db.put(key, value);
            }
            secretManager.registerApp(appId, shuffleSecret);
        }
    } catch (Exception e) {
        logger.error("Exception when initializing application {}", appId, e);
    }
}

From source file:org.apache.tajo.pullserver.PullServerAuxService.java

License:Apache License

@Override
public void initializeApplication(ApplicationInitializationContext appInitContext) {
    // TODO these bytes should be versioned
    // TODO: Once SHuffle is out of NM, this can use MR APIs
    this.appId = appInitContext.getApplicationId();
    this.queryId = TajoIdUtils.parseQueryId(appId.toString());
    this.userName = appInitContext.getUser();
    userRsrc.put(this.appId.toString(), this.userName);
}

From source file:org.apache.tajo.yarn.TajoPullServerService.java

License:Apache License

@Override
public void initializeApplication(ApplicationInitializationContext context) {
    // TODO these bytes should be versioned
    // TODO: Once SHuffle is out of NM, this can use MR APIs
    String user = context.getUser();
    ApplicationId appId = context.getApplicationId();
    //    ByteBuffer secret = context.getApplicationDataForService();
    userRsrc.put(appId.toString(), user);
}

From source file:org.apache.tez.auxservices.ShuffleHandler.java

License:Apache License

@Override
public void initializeApplication(ApplicationInitializationContext context) {

    String user = context.getUser();
    ApplicationId appId = context.getApplicationId();
    ByteBuffer secret = context.getApplicationDataForService();
    // TODO these bytes should be versioned
    try {// www.j a  va 2  s .c o  m
        Token<JobTokenIdentifier> jt = deserializeServiceData(secret);
        // TODO: Once SHuffle is out of NM, this can use MR APIs
        JobID jobId = new JobID(Long.toString(appId.getClusterTimestamp()), appId.getId());
        recordJobShuffleInfo(jobId, user, jt);
    } catch (IOException e) {
        LOG.error("Error during initApp", e);
        // TODO add API to AuxiliaryServices to report failures
    }
}

From source file:org.apache.tez.engine.common.shuffle.server.ShuffleHandler.java

License:Apache License

@Override
public void initializeApplication(ApplicationInitializationContext initAppContext) {
    // TODO these bytes should be versioned
    try {/*w  w  w.  ja  v  a2s .c o m*/
        String user = initAppContext.getUser();
        ApplicationId appId = initAppContext.getApplicationId();
        ByteBuffer secret = initAppContext.getApplicationDataForService();
        Token<JobTokenIdentifier> jt = deserializeServiceData(secret);
        // TODO: Once SHuffle is out of NM, this can use MR APIs
        userRsrc.put(appId.toString(), user);
        LOG.info("Added token for " + appId.toString());
        secretManager.addTokenForJob(appId.toString(), jt);
    } catch (IOException e) {
        LOG.error("Error during initApp", e);
        // TODO add API to AuxiliaryServices to report failures
    }
}