/** * Returns a set of extra system arguments that will be available through the {@link ProgramOptions#getArguments()} * for the program execution. */ protected Map<String, String> getExtraSystemArguments() { Map<String, String> args = new HashMap<>(); args.put(ProgramOptionConstants.INSTANCE_ID, context == null ? "0" : Integer.toString(context.getInstanceId())); args.put(ProgramOptionConstants.INSTANCES, context == null ? "1" : Integer.toString(context.getInstanceCount())); args.put(ProgramOptionConstants.TWILL_RUN_ID, context.getApplicationRunId().getId()); args.put(ProgramOptionConstants.HOST, context.getHost().getCanonicalHostName()); return args; }
/** * Returns a set of extra system arguments that will be available through the {@link ProgramOptions#getArguments()} * for the program execution. */ protected Map<String, String> getExtraSystemArguments() { Map<String, String> args = new HashMap<>(); args.put(ProgramOptionConstants.INSTANCE_ID, context == null ? "0" : Integer.toString(context.getInstanceId())); args.put(ProgramOptionConstants.INSTANCES, context == null ? "1" : Integer.toString(context.getInstanceCount())); args.put(ProgramOptionConstants.TWILL_RUN_ID, context.getApplicationRunId().getId()); args.put(ProgramOptionConstants.HOST, context.getHost().getCanonicalHostName()); return args; }
@Override protected void doInit(TwillContext context) { try { getCConfiguration().set(Constants.Transaction.ADDRESS, context.getHost().getCanonicalHostName()); LOG.info("Initializing runnable {}", name); Injector injector = createGuiceInjector(getCConfiguration(), getConfiguration()); //Get Zookeeper Client Instances zkClient = injector.getInstance(ZKClientService.class); // Get the metrics collection service metricsCollectionService = injector.getInstance(MetricsCollectionService.class); // Get the Transaction Service txService = injector.getInstance(TransactionService.class); LOG.info("Runnable initialized {}", name); } catch (Throwable t) { LOG.error(t.getMessage(), t); throw Throwables.propagate(t); } }
@Override protected Injector doInit(TwillContext context) { // Set the hostname of the machine so that cConf can be used to start internal services getCConfiguration().set(Constants.Metrics.ADDRESS, context.getHost().getCanonicalHostName()); LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.METRICS, context.getInstanceId()); injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS)); return injector; }
@Override protected Injector doInit(TwillContext context) { getCConfiguration().set(Constants.Transaction.Container.ADDRESS, context.getHost().getCanonicalHostName()); // Set the hostname of the machine so that cConf can be used to start internal services LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.TRANSACTION, context.getInstanceId()); injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.TRANSACTION)); return injector; }
@Override protected Injector doInit(TwillContext context) { getCConfiguration().set(Constants.MetricsProcessor.ADDRESS, context.getHost().getCanonicalHostName()); // Set the hostname of the machine so that cConf can be used to start internal services LOG.info("{} Setting host name to {}", name, context.getHost().getCanonicalHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.METRICS_PROCESSOR, context.getInstanceId()); injector = createGuiceInjector(getCConfiguration(), getConfiguration(), txClientId, context); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); return injector; }
@Override protected Injector doInit(TwillContext context) { CConfiguration cConf = getCConfiguration(); Configuration hConf = getConfiguration(); // Set the host name to the one provided by Twill cConf.set(Constants.Dataset.Executor.ADDRESS, context.getHost().getHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.DATASET_EXECUTOR, context.getInstanceId()); injector = createInjector(cConf, hConf, txClientId); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR)); return injector; }
@Override protected Injector doInit(TwillContext context) { CConfiguration cConf = getCConfiguration(); cConf.set(Constants.MessagingSystem.HTTP_SERVER_BIND_ADDRESS, context.getHost().getHostName()); cConf.setInt(Constants.MessagingSystem.CONTAINER_INSTANCE_ID, context.getInstanceId()); injector = createInjector(cConf, getConfiguration()); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.MESSAGING_SERVICE)); return injector; }
String hostName = context.getHost().getCanonicalHostName(); cConf.set(co.cask.cdap.common.conf.Constants.Service.MASTER_SERVICES_BIND_ADDRESS, hostName);
String hostName = context.getHost().getCanonicalHostName(); cConf.set(co.cask.cdap.common.conf.Constants.Service.MASTER_SERVICES_BIND_ADDRESS, hostName);
@Override protected Injector doInit(TwillContext context) { setupHive(); CConfiguration cConf = getCConfiguration(); Configuration hConf = getConfiguration(); addResource(hConf, "yarn-site.xml"); addResource(hConf, "mapred-site.xml"); addResource(hConf, "hive-site.xml"); addResource(hConf, "tez-site.xml"); // Set the host name to the one provided by Twill cConf.set(Constants.Explore.SERVER_ADDRESS, context.getHost().getHostName()); String txClientId = String.format("cdap.service.%s.%d", Constants.Service.EXPLORE_HTTP_USER_SERVICE, context.getInstanceId()); // NOTE: twill client will try to load all the classes present here - including hive classes but it // will fail since Hive classes are not in master classpath, and ignore those classes silently injector = createInjector(cConf, hConf, txClientId); injector.getInstance(LogAppenderInitializer.class).initialize(); LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getNamespace(), Constants.Logging.COMPONENT_NAME, Constants.Service.EXPLORE_HTTP_USER_SERVICE)); return injector; }