Search in sources :

Example 1 with AppSubmitter

use of com.tencent.angel.AppSubmitter in project angel by Tencent.

the class AngelRunJar method submit.

public static void submit(Configuration conf) throws Exception {
    LOG.info("angel python file: " + conf.get("angel.pyangel.pyfile"));
    if (null != conf.get("angel.pyangel.pyfile")) {
        conf.set(AngelConf.ANGEL_APP_SUBMIT_CLASS, "com.tencent.angel.api.python.PythonRunner");
    }
    // instance submitter class
    final String submitClassName = conf.get(AngelConf.ANGEL_APP_SUBMIT_CLASS, AngelConf.DEFAULT_ANGEL_APP_SUBMIT_CLASS);
    setKerberos(conf);
    UserGroupInformation ugi = UGITools.getCurrentUser(conf);
    ugi.doAs(new PrivilegedExceptionAction<String>() {

        @Override
        public String run() throws Exception {
            AppSubmitter submmiter = null;
            try {
                Class<?> submitClass = Class.forName(submitClassName);
                submmiter = (AppSubmitter) submitClass.newInstance();
                LOG.info("submitClass: " + submitClass.getName());
            } catch (Exception x) {
                String message = "load submit class failed " + x.getMessage();
                LOG.fatal(message, x);
                throw new InvalidParameterException(message);
            }
            submmiter.submit(conf);
            return "OK";
        }
    });
}
Also used : InvalidParameterException(com.tencent.angel.exception.InvalidParameterException) AppSubmitter(com.tencent.angel.AppSubmitter) InvalidParameterException(com.tencent.angel.exception.InvalidParameterException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

AppSubmitter (com.tencent.angel.AppSubmitter)1 InvalidParameterException (com.tencent.angel.exception.InvalidParameterException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1