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);
}
}
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);
}
}
Aggregations