Search in sources :

Example 26 with AngelException

use of com.tencent.angel.exception.AngelException in project angel by Tencent.

the class AngelLocalClient method startPSServer.

@Override
public void startPSServer() throws AngelException {
    try {
        setUser();
        setLocalAddr();
        conf.set("hadoop.http.filter.initializers", "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer");
        setInputDirectory();
        setOutputDirectory();
        initLocalClusterContext();
        cluster = new LocalCluster(conf, appId);
        cluster.start();
        updateMaster(Integer.MAX_VALUE);
        waitForAllPS(conf.getInt(AngelConf.ANGEL_PS_NUMBER, AngelConf.DEFAULT_ANGEL_PS_NUMBER));
        LOG.info("start ps success");
    } catch (Exception x) {
        LOG.error("start application failed.", x);
        throw new AngelException(x);
    }
}
Also used : AngelException(com.tencent.angel.exception.AngelException) LocalCluster(com.tencent.angel.localcluster.LocalCluster) ServiceException(com.google.protobuf.ServiceException) AngelException(com.tencent.angel.exception.AngelException)

Example 27 with AngelException

use of com.tencent.angel.exception.AngelException in project angel by Tencent.

the class AngelYarnClient method startPSServer.

@Override
public void startPSServer() throws AngelException {
    try {
        setUser();
        setLocalAddr();
        Path stagingDir = AngelApps.getStagingDir(conf, userName);
        // 2.get job id
        yarnClient = YarnClient.createYarnClient();
        YarnConfiguration yarnConf = new YarnConfiguration(conf);
        yarnClient.init(yarnConf);
        yarnClient.start();
        YarnClientApplication newApp;
        newApp = yarnClient.createApplication();
        GetNewApplicationResponse newAppResponse = newApp.getNewApplicationResponse();
        appId = newAppResponse.getApplicationId();
        JobID jobId = TypeConverter.fromYarn(appId);
        Path submitJobDir = new Path(stagingDir, appId.toString());
        jtFs = submitJobDir.getFileSystem(conf);
        conf.set("hadoop.http.filter.initializers", "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer");
        conf.set(AngelConf.ANGEL_JOB_DIR, submitJobDir.toString());
        conf.set(AngelConf.ANGEL_JOB_ID, jobId.toString());
        setInputDirectory();
        setOutputDirectory();
        // Credentials credentials = new Credentials();
        credentials.addAll(UserGroupInformation.getCurrentUser().getCredentials());
        TokenCache.obtainTokensForNamenodes(credentials, new Path[] { submitJobDir }, conf);
        checkParameters(conf);
        handleDeprecatedParameters(conf);
        // 4.copy resource files to hdfs
        copyAndConfigureFiles(conf, submitJobDir, (short) 10);
        // 5.write configuration to a xml file
        Path submitJobFile = JobSubmissionFiles.getJobConfPath(submitJobDir);
        TokenCache.cleanUpTokenReferral(conf);
        writeConf(conf, submitJobFile);
        // 6.create am container context
        ApplicationSubmissionContext appContext = createApplicationSubmissionContext(conf, submitJobDir, credentials, appId);
        conf.set(AngelConf.ANGEL_JOB_LIBJARS, "");
        // 7.Submit to ResourceManager
        appId = yarnClient.submitApplication(appContext);
        // 8.get app master client
        updateMaster(10 * 60);
        waitForAllPS(conf.getInt(AngelConf.ANGEL_PS_NUMBER, AngelConf.DEFAULT_ANGEL_PS_NUMBER));
        LOG.info("start pss success");
    } catch (Exception x) {
        LOG.error("submit application to yarn failed.", x);
        throw new AngelException(x);
    }
}
Also used : AngelException(com.tencent.angel.exception.AngelException) GetNewApplicationResponse(org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse) YarnClientApplication(org.apache.hadoop.yarn.client.api.YarnClientApplication) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) JobID(org.apache.hadoop.mapreduce.JobID) ServiceException(com.google.protobuf.ServiceException) URISyntaxException(java.net.URISyntaxException) AngelException(com.tencent.angel.exception.AngelException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Aggregations

AngelException (com.tencent.angel.exception.AngelException)27 ServiceException (com.google.protobuf.ServiceException)8 IOException (java.io.IOException)6 MatrixClient (com.tencent.angel.psagent.matrix.MatrixClient)5 InvalidParameterException (com.tencent.angel.exception.InvalidParameterException)3 TVector (com.tencent.angel.ml.math.TVector)3 DenseDoubleVector (com.tencent.angel.ml.math.vector.DenseDoubleVector)3 SparseDoubleVector (com.tencent.angel.ml.math.vector.SparseDoubleVector)3 ArrayList (java.util.ArrayList)3 MatrixContext (com.tencent.angel.ml.matrix.MatrixContext)2 IndexGetFunc (com.tencent.angel.ml.matrix.psf.get.enhance.indexed.IndexGetFunc)2 IndexGetParam (com.tencent.angel.ml.matrix.psf.get.enhance.indexed.IndexGetParam)2 ModelLineConvert (com.tencent.angel.tools.ModelLineConvert)2 TextModelLineConvert (com.tencent.angel.tools.TextModelLineConvert)2 Random (java.util.Random)2 FileStatus (org.apache.hadoop.fs.FileStatus)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 Path (org.apache.hadoop.fs.Path)2 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)2 Output (com.esotericsoftware.kryo.io.Output)1