/** * Returns the {@link MapReduceTaskContextProvider} associated with this ClassLoader. */ public MapReduceTaskContextProvider getTaskContextProvider() { // Logging context needs to be set in main thread. LoggingContext loggingContext = createMapReduceLoggingContext(); LoggingContextAccessor.setLoggingContext(loggingContext); synchronized (this) { taskContextProvider = Optional.fromNullable(taskContextProvider).or(taskContextProviderSupplier); } taskContextProvider.startAndWait(); return taskContextProvider; }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(loggingContext); runningThread = Thread.currentThread(); createLocalDatasets(); workflow = initializeWorkflow(); }
/** * Returns the {@link MapReduceTaskContextProvider} associated with this ClassLoader. */ public MapReduceTaskContextProvider getTaskContextProvider() { // Logging context needs to be set in main thread. LoggingContext loggingContext = createMapReduceLoggingContext(); LoggingContextAccessor.setLoggingContext(loggingContext); synchronized (this) { taskContextProvider = Optional.fromNullable(taskContextProvider).or(taskContextProviderSupplier); } taskContextProvider.startAndWait(); return taskContextProvider; }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(loggingContext); runningThread = Thread.currentThread(); createLocalDatasets(); workflow = initializeWorkflow(); }
@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 void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS)); LOG.info("Starting Metrics Service..."); httpService.start(); LOG.info("Started Metrics HTTP Service..."); // Register the service cancelDiscovery = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS, httpService.getBindAddress()))); LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); LOG.info("Starting MetricsProcessor Status Service..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress()))); LOG.info("Started MetricsProcessor Status Service."); }
@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 void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS_PROCESSOR)); LOG.info("Starting MetricsProcessor Status Service..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS_PROCESSOR, httpService.getBindAddress()))); LOG.info("Started MetricsProcessor Status Service."); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.METRICS)); LOG.info("Starting Metrics Service..."); httpService.start(); LOG.info("Started Metrics HTTP Service..."); // Register the service cancelDiscovery = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.METRICS, httpService.getBindAddress()))); LOG.info("Metrics Service started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR)); LOG.info("Starting DatasetOpExecutorService..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress()))); LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress()); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.DATASET_EXECUTOR)); LOG.info("Starting DatasetOpExecutorService..."); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.DATASET_EXECUTOR, httpService.getBindAddress()))); LOG.info("DatasetOpExecutorService started successfully on {}", httpService.getBindAddress()); }
@Override protected void shutDown() throws Exception { LoggingContextAccessor.setLoggingContext(flowletContext.getLoggingContext()); if (flowletProcessDriver != null) { stopService(flowletProcessDriver); } destroyFlowlet(); LOG.info("Stopped Flowlet '{}' Instance {} for Flow '{}'", flowletContext.getFlowletId(), flowletContext.getInstanceId(), flowletContext.getFlowId()); stopService(serviceHook); }
@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; }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(flowletContext.getLoggingContext()); flowletContext.getProgramMetrics().increment("process.instance", 1); flowletProcessDriver = new FlowletProcessDriver(flowletContext, dataFabricFacade, txCallback, processSpecs); serviceHook.startAndWait(); initFlowlet(); flowletProcessDriver.startAndWait(); LOG.info("Started Flowlet '{}' for Flow '{}'. Flowlet details: [{}]", flowletContext.getFlowletId(), flowletContext.getFlowId(), flowletContext); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.LOG_QUERY)); httpServer.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOG_QUERY, httpServer.getBindAddress()))); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(NamespaceId.SYSTEM.getEntityName(), Constants.Logging.COMPONENT_NAME, Constants.Service.STREAMS)); httpService.start(); discoverable = ResolvingDiscoverable.of(new Discoverable(Constants.Service.STREAMS, httpService.getBindAddress())); cancellable = discoveryService.register(discoverable); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.LOGSAVER)); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOGSAVER, httpService.getBindAddress()))); }
@Override protected void startUp() throws Exception { LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(), Constants.Logging.COMPONENT_NAME, Constants.Service.LOGSAVER)); httpService.start(); cancellable = discoveryService.register( ResolvingDiscoverable.of(new Discoverable(Constants.Service.LOGSAVER, httpService.getBindAddress()))); }