本文整理匯總了Java中org.apache.hadoop.yarn.service.Service類的典型用法代碼示例。如果您正苦於以下問題:Java Service類的具體用法?Java Service怎麽用?Java Service使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Service類屬於org.apache.hadoop.yarn.service包,在下文中一共展示了Service類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addIfService
import org.apache.hadoop.yarn.service.Service; //導入依賴的package包/類
protected void addIfService(Object object) {
if (object instanceof Service) {
addService((Service) object);
}
}
示例2: init
import org.apache.hadoop.yarn.service.Service; //導入依賴的package包/類
@Override
public void init(Configuration conf) {
conf.setSocketAddr(YarnConfiguration.RM_ADDRESS, new InetSocketAddress("127.0.0.1", 0));
conf.setSocketAddr(YarnConfiguration.RM_SCHEDULER_ADDRESS, new InetSocketAddress("127.0.0.1", 0));
conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME);
if (conf.get(MRJobConfig.MR_AM_STAGING_DIR) == null) {
conf.set(MRJobConfig.MR_AM_STAGING_DIR, new File(getTestWorkDir(),
"apps_staging_dir/").getAbsolutePath());
}
conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "000");
try {
Path stagingPath = FileContext.getFileContext(conf).makeQualified(
new Path(conf.get(MRJobConfig.MR_AM_STAGING_DIR)));
FileContext fc=FileContext.getFileContext(stagingPath.toUri(), conf);
if (fc.util().exists(stagingPath)) {
LOG.info(stagingPath + " exists! deleting...");
fc.delete(stagingPath, true);
}
LOG.info("mkdir: " + stagingPath);
//mkdir the staging directory so that right permissions are set while running as proxy user
fc.mkdir(stagingPath, null, true);
//mkdir done directory as well
String doneDir = JobHistoryUtils
.getConfiguredHistoryServerDoneDirPrefix(conf);
Path doneDirPath = fc.makeQualified(new Path(doneDir));
fc.mkdir(doneDirPath, null, true);
} catch (IOException e) {
throw new YarnException("Could not create staging directory. ", e);
}
conf.set(MRConfig.MASTER_ADDRESS, "test"); // The default is local because of
// which shuffle doesn't happen
//configure the shuffle service in NM
conf.setStrings(YarnConfiguration.NM_AUX_SERVICES, PullServerAuxService.PULLSERVER_SERVICEID);
conf.setClass(String.format(YarnConfiguration.NM_AUX_SERVICE_FMT,
PullServerAuxService.PULLSERVER_SERVICEID), PullServerAuxService.class,
Service.class);
// Non-standard shuffle port
conf.setInt(TajoConf.ConfVars.PULLSERVER_PORT.name(), 0);
// local directory
conf.set(TajoConf.ConfVars.WORKER_TEMPORAL_DIR.name(), "/tmp/tajo-localdir");
conf.setClass(YarnConfiguration.NM_CONTAINER_EXECUTOR,
DefaultContainerExecutor.class, ContainerExecutor.class);
// TestMRJobs is for testing non-uberized operation only; see TestUberAM
// for corresponding uberized tests.
conf.setBoolean(MRJobConfig.JOB_UBERTASK_ENABLE, false);
conf.setInt("yarn.nodemanager.delete.debug-delay-sec", 600);
super.init(conf);
}