Search in sources :

Example 1 with SmileModule

use of io.prestosql.protocol.SmileModule in project hetu-core by openlookeng.

the class PrestoServer method run.

@Override
public void run() {
    verifyJvmRequirements();
    verifySystemTimeIsReasonable();
    Logger log = Logger.get(PrestoServer.class);
    ImmutableList.Builder<Module> modules = ImmutableList.builder();
    modules.add(new NodeModule(), Modules.override(new DiscoveryModule()).with(new HetuDiscoveryModule()), Modules.override(new HttpServerModule()).with(new HetuHttpServerModule()), new JsonModule(), new SmileModule(), new JaxrsModule(), new MBeanModule(), new PrefixObjectNameGeneratorModule("io.prestosql"), new HetuJmxModule(), new JmxHttpModule(), new LogJmxModule(), new TraceTokenModule(), new JsonEventModule(), new HttpEventModule(), new ServerSecurityModule(), new AccessControlModule(), new PasswordSecurityModule(), new EventListenerModule(), new ServerMainModule(sqlParserOptions), new NodeStateChangeModule(), new WarningCollectorModule());
    modules.addAll(getAdditionalModules());
    Bootstrap app = new Bootstrap(modules.build());
    try {
        Injector injector = app.strictConfig().initialize();
        logLocation(log, "Working directory", Paths.get("."));
        logLocation(log, "Etc directory", Paths.get("etc"));
        injector.getInstance(PluginManager.class).loadPlugins();
        FileSystemClientManager fileSystemClientManager = injector.getInstance(FileSystemClientManager.class);
        fileSystemClientManager.loadFactoryConfigs();
        injector.getInstance(SeedStoreManager.class).loadSeedStore();
        if (injector.getInstance(SeedStoreManager.class).isSeedStoreOnYarnEnabled()) {
            addSeedOnYarnInformation(injector.getInstance(ServerConfig.class), injector.getInstance(SeedStoreManager.class), (HetuHttpServerInfo) injector.getInstance(HttpServerInfo.class));
        }
        launchEmbeddedStateStore(injector.getInstance(HetuConfig.class), injector.getInstance(StateStoreLauncher.class));
        injector.getInstance(StateStoreProvider.class).loadStateStore();
        // relies on state-store
        injector.getInstance(HetuMetaStoreManager.class).loadHetuMetastore(fileSystemClientManager);
        // relies on metastore
        injector.getInstance(HeuristicIndexerManager.class).buildIndexClient();
        injector.getInstance(StaticFunctionNamespaceStore.class).loadFunctionNamespaceManagers();
        injector.getInstance(StaticCatalogStore.class).loadCatalogs();
        injector.getInstance(DynamicCatalogStore.class).loadCatalogStores(fileSystemClientManager);
        injector.getInstance(DynamicCatalogScanner.class).start();
        injector.getInstance(SessionPropertyDefaults.class).loadConfigurationManager();
        injector.getInstance(ResourceGroupManager.class).loadConfigurationManager();
        injector.getInstance(AccessControlManager.class).loadSystemAccessControl();
        injector.getInstance(PasswordAuthenticatorManager.class).loadPasswordAuthenticator();
        injector.getInstance(EventListenerManager.class).loadConfiguredEventListener();
        injector.getInstance(GroupProviderManager.class).loadConfiguredGroupProvider();
        // preload index (on coordinator only)
        if (injector.getInstance(ServerConfig.class).isCoordinator()) {
            HeuristicIndexerManager heuristicIndexerManager = injector.getInstance(HeuristicIndexerManager.class);
            heuristicIndexerManager.preloadIndex();
            heuristicIndexerManager.initCache();
        }
        // register dynamic filter listener
        registerStateStoreListeners(injector.getInstance(StateStoreListenerManager.class), injector.getInstance(DynamicFilterCacheManager.class), injector.getInstance(ServerConfig.class), injector.getInstance(NodeSchedulerConfig.class));
        // Initialize snapshot Manager
        injector.getInstance(SnapshotUtils.class).initialize();
        injector.getInstance(Announcer.class).start();
        injector.getInstance(ServerInfoResource.class).startupComplete();
        log.info("======== SERVER STARTED ========");
    } catch (Throwable e) {
        log.error(e);
        System.exit(1);
    }
}
Also used : AccessControlManager(io.prestosql.security.AccessControlManager) HetuDiscoveryModule(io.prestosql.discovery.HetuDiscoveryModule) DiscoveryModule(io.airlift.discovery.client.DiscoveryModule) StateStoreListenerManager(io.prestosql.statestore.listener.StateStoreListenerManager) JsonEventModule(io.airlift.event.client.JsonEventModule) PasswordAuthenticatorManager(io.prestosql.server.security.PasswordAuthenticatorManager) Announcer(io.airlift.discovery.client.Announcer) Injector(com.google.inject.Injector) StaticCatalogStore(io.prestosql.metadata.StaticCatalogStore) NodeModule(io.airlift.node.NodeModule) PasswordSecurityModule(io.prestosql.security.PasswordSecurityModule) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) StaticFunctionNamespaceStore(io.prestosql.metadata.StaticFunctionNamespaceStore) ResourceGroupManager(io.prestosql.execution.resourcegroups.ResourceGroupManager) LogJmxModule(io.airlift.log.LogJmxModule) JsonModule(io.airlift.json.JsonModule) EventListenerManager(io.prestosql.eventlistener.EventListenerManager) TraceTokenModule(io.airlift.tracetoken.TraceTokenModule) HttpServerModule(io.airlift.http.server.HttpServerModule) HetuHttpServerModule(io.prestosql.httpserver.HetuHttpServerModule) Module(com.google.inject.Module) MBeanModule(org.weakref.jmx.guice.MBeanModule) HetuJmxModule(io.prestosql.jmx.HetuJmxModule) HttpServerModule(io.airlift.http.server.HttpServerModule) HttpEventModule(io.airlift.event.client.http.HttpEventModule) TraceTokenModule(io.airlift.tracetoken.TraceTokenModule) SmileModule(io.prestosql.protocol.SmileModule) WarningCollectorModule(io.prestosql.execution.warnings.WarningCollectorModule) HetuHttpServerModule(io.prestosql.httpserver.HetuHttpServerModule) JaxrsModule(io.airlift.jaxrs.JaxrsModule) ServerSecurityModule(io.prestosql.server.security.ServerSecurityModule) JmxHttpModule(io.airlift.jmx.JmxHttpModule) HetuDiscoveryModule(io.prestosql.discovery.HetuDiscoveryModule) JsonEventModule(io.airlift.event.client.JsonEventModule) NodeModule(io.airlift.node.NodeModule) AccessControlModule(io.prestosql.security.AccessControlModule) EventListenerModule(io.prestosql.eventlistener.EventListenerModule) DiscoveryModule(io.airlift.discovery.client.DiscoveryModule) LogJmxModule(io.airlift.log.LogJmxModule) PasswordSecurityModule(io.prestosql.security.PasswordSecurityModule) JsonModule(io.airlift.json.JsonModule) JmxHttpModule(io.airlift.jmx.JmxHttpModule) MBeanModule(org.weakref.jmx.guice.MBeanModule) WarningCollectorModule(io.prestosql.execution.warnings.WarningCollectorModule) HetuJmxModule(io.prestosql.jmx.HetuJmxModule) ImmutableList(com.google.common.collect.ImmutableList) DynamicCatalogStore(io.prestosql.catalog.DynamicCatalogStore) HetuDiscoveryModule(io.prestosql.discovery.HetuDiscoveryModule) NodeSchedulerConfig(io.prestosql.execution.scheduler.NodeSchedulerConfig) Logger(io.airlift.log.Logger) HetuConfig(io.prestosql.utils.HetuConfig) StateStoreProvider(io.prestosql.statestore.StateStoreProvider) HttpEventModule(io.airlift.event.client.http.HttpEventModule) SeedStoreManager(io.prestosql.seedstore.SeedStoreManager) ServerSecurityModule(io.prestosql.server.security.ServerSecurityModule) SnapshotUtils(io.prestosql.snapshot.SnapshotUtils) Bootstrap(io.airlift.bootstrap.Bootstrap) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager) GroupProviderManager(io.prestosql.security.GroupProviderManager) EventListenerModule(io.prestosql.eventlistener.EventListenerModule) DynamicFilterCacheManager(io.prestosql.dynamicfilter.DynamicFilterCacheManager) AccessControlModule(io.prestosql.security.AccessControlModule) JaxrsModule(io.airlift.jaxrs.JaxrsModule) HetuHttpServerModule(io.prestosql.httpserver.HetuHttpServerModule) FileSystemClientManager(io.prestosql.filesystem.FileSystemClientManager) DynamicCatalogScanner(io.prestosql.catalog.DynamicCatalogScanner) SmileModule(io.prestosql.protocol.SmileModule) StateStoreLauncher(io.prestosql.statestore.StateStoreLauncher)

Example 2 with SmileModule

use of io.prestosql.protocol.SmileModule in project hetu-core by openlookeng.

the class TestHttpRemoteTask method createHttpRemoteTaskFactory.

private static HttpRemoteTaskFactory createHttpRemoteTaskFactory(TestingTaskResource testingTaskResource) throws Exception {
    Bootstrap app = new Bootstrap(new JsonModule(), new SmileModule(), new HandleJsonModule(), new Module() {

        @Override
        public void configure(Binder binder) {
            binder.bind(JsonMapper.class);
            binder.bind(Metadata.class).toInstance(createTestMetadataManager());
            jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
            jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class);
            jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class);
            jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class);
            smileCodecBinder(binder).bindSmileCodec(TaskStatus.class);
            smileCodecBinder(binder).bindSmileCodec(TaskInfo.class);
            smileCodecBinder(binder).bindSmileCodec(TaskUpdateRequest.class);
        }

        @Provides
        private HttpRemoteTaskFactory createHttpRemoteTaskFactory(JsonMapper jsonMapper, JsonCodec<TaskStatus> taskStatusJsonCodec, SmileCodec<TaskStatus> taskStatusSmileCodec, JsonCodec<TaskInfo> taskInfoJsonCodec, SmileCodec<TaskInfo> taskInfoSmileCodec, JsonCodec<TaskUpdateRequest> taskUpdateRequestJsonCodec, SmileCodec<TaskUpdateRequest> taskUpdateRequestSmileCodec) {
            JaxrsTestingHttpProcessor jaxrsTestingHttpProcessor = new JaxrsTestingHttpProcessor(URI.create("http://fake.invalid/"), testingTaskResource, jsonMapper);
            TestingHttpClient testingHttpClient = new TestingHttpClient(jaxrsTestingHttpProcessor.setTrace(TRACE_HTTP));
            testingTaskResource.setHttpClient(testingHttpClient);
            return new HttpRemoteTaskFactory(new QueryManagerConfig(), TASK_MANAGER_CONFIG, testingHttpClient, new TestSqlTaskManager.MockLocationFactory(), taskStatusJsonCodec, taskStatusSmileCodec, taskInfoJsonCodec, taskInfoSmileCodec, taskUpdateRequestJsonCodec, taskUpdateRequestSmileCodec, new RemoteTaskStats(), new InternalCommunicationConfig());
        }
    });
    Injector injector = app.strictConfig().doNotInitializeLogging().quiet().initialize();
    HandleResolver handleResolver = injector.getInstance(HandleResolver.class);
    handleResolver.addConnectorName("test", new TestingHandleResolver());
    return injector.getInstance(HttpRemoteTaskFactory.class);
}
Also used : TestingHandleResolver(io.prestosql.testing.TestingHandleResolver) HandleResolver(io.prestosql.metadata.HandleResolver) JsonMapper(io.airlift.jaxrs.JsonMapper) TaskInfo(io.prestosql.execution.TaskInfo) JsonBinder.jsonBinder(io.airlift.json.JsonBinder.jsonBinder) JsonCodecBinder.jsonCodecBinder(io.airlift.json.JsonCodecBinder.jsonCodecBinder) Binder(com.google.inject.Binder) SmileCodecBinder.smileCodecBinder(io.prestosql.protocol.SmileCodecBinder.smileCodecBinder) InternalCommunicationConfig(io.prestosql.server.InternalCommunicationConfig) JaxrsTestingHttpProcessor(io.airlift.jaxrs.testing.JaxrsTestingHttpProcessor) HandleJsonModule(io.prestosql.metadata.HandleJsonModule) Injector(com.google.inject.Injector) HttpRemoteTaskFactory(io.prestosql.server.HttpRemoteTaskFactory) TestingHttpClient(io.airlift.http.client.testing.TestingHttpClient) Bootstrap(io.airlift.bootstrap.Bootstrap) TypeDeserializer(io.prestosql.type.TypeDeserializer) TestingHandleResolver(io.prestosql.testing.TestingHandleResolver) TaskUpdateRequest(io.prestosql.server.TaskUpdateRequest) TaskStatus(io.prestosql.execution.TaskStatus) Provides(com.google.inject.Provides) JsonModule(io.airlift.json.JsonModule) HandleJsonModule(io.prestosql.metadata.HandleJsonModule) SmileModule(io.prestosql.protocol.SmileModule) QueryManagerConfig(io.prestosql.execution.QueryManagerConfig) Module(com.google.inject.Module) SmileModule(io.prestosql.protocol.SmileModule) JsonModule(io.airlift.json.JsonModule) HandleJsonModule(io.prestosql.metadata.HandleJsonModule)

Aggregations

Injector (com.google.inject.Injector)2 Module (com.google.inject.Module)2 Bootstrap (io.airlift.bootstrap.Bootstrap)2 JsonModule (io.airlift.json.JsonModule)2 SmileModule (io.prestosql.protocol.SmileModule)2 ImmutableList (com.google.common.collect.ImmutableList)1 Binder (com.google.inject.Binder)1 Provides (com.google.inject.Provides)1 Announcer (io.airlift.discovery.client.Announcer)1 DiscoveryModule (io.airlift.discovery.client.DiscoveryModule)1 JsonEventModule (io.airlift.event.client.JsonEventModule)1 HttpEventModule (io.airlift.event.client.http.HttpEventModule)1 TestingHttpClient (io.airlift.http.client.testing.TestingHttpClient)1 HttpServerModule (io.airlift.http.server.HttpServerModule)1 JaxrsModule (io.airlift.jaxrs.JaxrsModule)1 JsonMapper (io.airlift.jaxrs.JsonMapper)1 JaxrsTestingHttpProcessor (io.airlift.jaxrs.testing.JaxrsTestingHttpProcessor)1 JmxHttpModule (io.airlift.jmx.JmxHttpModule)1 JsonBinder.jsonBinder (io.airlift.json.JsonBinder.jsonBinder)1 JsonCodecBinder.jsonCodecBinder (io.airlift.json.JsonCodecBinder.jsonCodecBinder)1