Package com.cloudera.iterativereduce.yarn.client

Source Code of com.cloudera.iterativereduce.yarn.client.Kill

package com.cloudera.iterativereduce.yarn.client;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.ClientRMProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.util.Records;

import com.cloudera.iterativereduce.yarn.ResourceManagerHandler;

public class Kill {
  public static Log LOG = LogFactory.getLog(Kill.class);
 
  public static void main(String[] args) throws Exception {
    if (args.length < 1)
      throw new IllegalArgumentException("Need at least one argument - appId to kill");

    ApplicationId appId = ConverterUtils.toApplicationId(args[0]);
    LOG.info("Using Application ID: " + appId.toString());
   
    ResourceManagerHandler rmh = new ResourceManagerHandler(new Configuration(), null);
    ClientRMProtocol crm = rmh.getClientResourceManager();
   
    KillApplicationRequest kar = Records.newRecord(KillApplicationRequest.class);
    kar.setApplicationId(appId);
   
    LOG.info("Sending kill request");
    crm.forceKillApplication(kar);
  }
}
TOP

Related Classes of com.cloudera.iterativereduce.yarn.client.Kill

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.