Skip to content

Commit

Permalink
[CDAP-21096] Parametrize the AppFabricServiceRuntimeModule
Browse files Browse the repository at this point in the history
  • Loading branch information
vsethi09 committed Jan 16, 2025
1 parent 94d7671 commit d1a8b10
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.cdap.cdap.app.DefaultAppConfigurer;
import io.cdap.cdap.app.DefaultApplicationContext;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 28 in cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/runtime/distributed/DistributedWorkflowProgramRunnerTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
import io.cdap.cdap.app.guice.TwillModule;
Expand Down Expand Up @@ -69,6 +70,7 @@
import io.cdap.cdap.security.guice.SecureStoreServerModule;
import java.io.IOException;
import java.util.Collections;
import java.util.EnumSet;

Check warning on line 73 in cdap-app-fabric-tests/src/test/java/io/cdap/cdap/internal/app/runtime/distributed/DistributedWorkflowProgramRunnerTest.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
import org.apache.twill.api.Configs;
Expand Down Expand Up @@ -289,7 +291,8 @@ private static ProgramRunnerFactory createProgramRunnerFactory(CConfiguration cC
new AuthorizationModule(),
new AuthorizationEnforcementModule().getMasterModule(),
new TwillModule(),
new AppFabricServiceRuntimeModule(cConf).getDistributedModules(),
new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getDistributedModules(),
new ProgramRunnerRuntimeModule().getDistributedModules(),
new SecureStoreServerModule(),
new OperationalStatsModule(),
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.cdap.cdap.api.artifact.ArtifactManager;
import io.cdap.cdap.api.metrics.MetricsCollectionService;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 36 in cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/worker/system/SystemWorkerTwillRunnable.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuditLogWriterModule;
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.DistributedArtifactManagerModule;
Expand Down Expand Up @@ -91,6 +92,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;

Check warning on line 95 in cdap-app-fabric/src/main/java/io/cdap/cdap/internal/app/worker/system/SystemWorkerTwillRunnable.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -156,7 +158,8 @@ protected void bindKeyManager(Binder binder) {
new AuthorizationModule(),
new AuthorizationEnforcementModule().getMasterModule(),
new AuditLogWriterModule(cConf).getDistributedModules(),
Modules.override(new AppFabricServiceRuntimeModule(cConf).getDistributedModules())
Modules.override(new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getDistributedModules())
.with(new AbstractModule() {
// To enable localisation of artifacts
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.inject.AbstractModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 21 in cdap-app-fabric/src/test/java/io/cdap/cdap/internal/guice/AppFabricTestModule.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
Expand Down Expand Up @@ -49,6 +50,7 @@
import io.cdap.cdap.security.authorization.AuthorizationEnforcementModule;
import io.cdap.cdap.security.guice.SecureStoreServerModule;
import java.io.File;
import java.util.EnumSet;

Check warning on line 53 in cdap-app-fabric/src/test/java/io/cdap/cdap/internal/guice/AppFabricTestModule.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import javax.annotation.Nullable;
import org.apache.hadoop.conf.Configuration;
import org.apache.twill.api.TwillRunner;
Expand Down Expand Up @@ -91,7 +93,8 @@ protected void configure() {
install(RemoteAuthenticatorModules.getNoOpModule());
install(new IOModule());
install(new InMemoryDiscoveryModule());
install(new AppFabricServiceRuntimeModule(cConf).getInMemoryModules());
install(new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getInMemoryModules());
install(new MonitorHandlerModule(false));
install(new ProgramRunnerRuntimeModule().getInMemoryModules());
install(new NonCustomLocationUnitTestModule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.inject.Key;
import io.cdap.cdap.api.metrics.MetricsCollectionService;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 33 in cdap-master/src/main/java/io/cdap/cdap/data/runtime/main/MasterServiceMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuditLogWriterModule;
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
Expand Down Expand Up @@ -105,6 +106,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;

Check warning on line 109 in cdap-master/src/main/java/io/cdap/cdap/data/runtime/main/MasterServiceMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -547,7 +549,8 @@ protected void configure() {
new AuthorizationModule(),
new AuthorizationEnforcementModule().getMasterModule(),
new TwillModule(),
new AppFabricServiceRuntimeModule(cConf).getDistributedModules(),
new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getDistributedModules(),
new MonitorHandlerModule(true),
new ProgramRunnerRuntimeModule().getDistributedModules(),
new SecureStoreServerModule(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.cdap.cdap.api.dataset.lib.CloseableIterator;
import io.cdap.cdap.api.schedule.Trigger;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 36 in cdap-master/src/main/java/io/cdap/cdap/data/tools/JobQueueDebugger.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
import io.cdap.cdap.app.guice.TwillModule;
Expand Down Expand Up @@ -73,6 +74,7 @@
import io.cdap.cdap.spi.data.transaction.TransactionRunner;
import io.cdap.cdap.spi.data.transaction.TransactionRunners;
import java.io.IOException;
import java.util.EnumSet;

Check warning on line 77 in cdap-master/src/main/java/io/cdap/cdap/data/tools/JobQueueDebugger.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.List;
import javax.annotation.Nullable;
import org.apache.commons.cli.BasicParser;
Expand Down Expand Up @@ -346,7 +348,8 @@ private static Injector createInjector() throws Exception {
new TwillModule(),
new DataFabricModules().getDistributedModules(),
new DataSetsModules().getDistributedModules(),
new AppFabricServiceRuntimeModule(cConf).getDistributedModules(),
new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getDistributedModules(),
new ProgramRunnerRuntimeModule().getDistributedModules(),
new SystemDatasetRuntimeModule().getDistributedModules(),
new KafkaLogAppenderModule(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.inject.Scopes;
import com.google.inject.util.Modules;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
Expand Down Expand Up @@ -65,6 +66,7 @@
import io.cdap.cdap.security.guice.SecureStoreServerModule;
import io.cdap.cdap.security.store.SecureStoreService;
import java.util.Arrays;
import java.util.EnumSet;

Check warning on line 69 in cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/AppFabricProcessorServiceMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -98,7 +100,8 @@ protected List<Module> getServiceModules(MasterEnvironment masterEnv,
new AuditModule(),
new AuthorizationModule(),
new AuthorizationEnforcementModule().getMasterModule(),
Modules.override(new AppFabricServiceRuntimeModule(cConf).getDistributedModules())
Modules.override(new AppFabricServiceRuntimeModule(cConf, ServiceType.PROCESSOR)
.getDistributedModules())
.with(new AbstractModule() {
@Override
protected void configure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.inject.Scopes;
import com.google.inject.util.Modules;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
Expand Down Expand Up @@ -65,6 +66,7 @@
import io.cdap.cdap.security.guice.SecureStoreServerModule;
import io.cdap.cdap.security.store.SecureStoreService;
import java.util.Arrays;
import java.util.EnumSet;

Check warning on line 69 in cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/AppFabricServiceMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -98,7 +100,7 @@ protected List<Module> getServiceModules(MasterEnvironment masterEnv,
new AuditModule(),
new AuthorizationModule(),
new AuthorizationEnforcementModule().getMasterModule(),
Modules.override(new AppFabricServiceRuntimeModule(cConf).getDistributedModules())
Modules.override(new AppFabricServiceRuntimeModule(cConf, ServiceType.SERVER).getDistributedModules())
.with(new AbstractModule() {
@Override
protected void configure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.inject.Module;
import com.google.inject.Scopes;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
import io.cdap.cdap.app.preview.PreviewHttpServer;
Expand All @@ -51,6 +52,7 @@
import io.cdap.cdap.security.guice.SecureStoreClientModule;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;

Check warning on line 55 in cdap-master/src/main/java/io/cdap/cdap/master/environment/k8s/PreviewServiceMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -98,7 +100,7 @@ protected List<Module> getServiceModules(MasterEnvironment masterEnv,
List<Module> modules = new ArrayList<>(Arrays.asList(
new DataSetServiceModules().getStandaloneModules(),
new DataSetsModules().getStandaloneModules(),
new AppFabricServiceRuntimeModule(cConf).getStandaloneModules(),
new AppFabricServiceRuntimeModule(cConf, ServiceType.SERVER).getStandaloneModules(),
new ProgramRunnerRuntimeModule().getStandaloneModules(),
new MetricsStoreModule(),
new MessagingServiceModule(cConf),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.inject.name.Names;
import io.cdap.cdap.api.metrics.MetricsCollectionService;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 32 in cdap-standalone/src/main/java/io/cdap/cdap/StandaloneMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
Expand Down Expand Up @@ -110,6 +111,7 @@
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.util.EnumSet;

Check warning on line 114 in cdap-standalone/src/main/java/io/cdap/cdap/StandaloneMain.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.counters.Limits;
Expand Down Expand Up @@ -564,7 +566,8 @@ private static List<Module> createPersistentModules(CConfiguration cConf, Config
new PreviewManagerModule(false),
new PreviewRunnerManagerModule().getStandaloneModules(),
new MessagingServerRuntimeModule().getStandaloneModules(),
new AppFabricServiceRuntimeModule(cConf).getStandaloneModules(),
new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getStandaloneModules(),
new MonitorHandlerModule(false),
new RuntimeServerModule(),
new OperationalStatsModule(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.inject.AbstractModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 21 in cdap-support-bundle/src/test/java/io/cdap/cdap/SupportBundleTestModule.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
Expand Down Expand Up @@ -49,6 +50,7 @@
import io.cdap.cdap.security.authorization.AuthorizationEnforcementModule;
import io.cdap.cdap.security.guice.SecureStoreServerModule;
import java.io.File;
import java.util.EnumSet;

Check warning on line 53 in cdap-support-bundle/src/test/java/io/cdap/cdap/SupportBundleTestModule.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - java.util.EnumSet.
import javax.annotation.Nullable;
import org.apache.hadoop.conf.Configuration;
import org.apache.twill.api.TwillRunner;
Expand Down Expand Up @@ -85,7 +87,8 @@ protected void configure() {
install(RemoteAuthenticatorModules.getNoOpModule());
install(new IOModule());
install(new InMemoryDiscoveryModule());
install(new AppFabricServiceRuntimeModule(cConf).getInMemoryModules());
install(new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getInMemoryModules());
install(new MonitorHandlerModule(false));
install(new ProgramRunnerRuntimeModule().getInMemoryModules());
install(new NonCustomLocationUnitTestModule());
Expand Down
4 changes: 3 additions & 1 deletion cdap-unit-test/src/main/java/io/cdap/cdap/test/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import io.cdap.cdap.api.security.store.SecureStore;
import io.cdap.cdap.api.security.store.SecureStoreManager;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule;
import io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType;

Check warning on line 56 in cdap-unit-test/src/main/java/io/cdap/cdap/test/TestBase.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck

Unused import - io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule.ServiceType.
import io.cdap.cdap.app.guice.AuthorizationModule;
import io.cdap.cdap.app.guice.MonitorHandlerModule;
import io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule;
Expand Down Expand Up @@ -301,7 +302,8 @@ public static void initialize() throws Exception {
new IOModule(),
new LocalLocationModule(),
new InMemoryDiscoveryModule(),
new AppFabricServiceRuntimeModule(cConf).getInMemoryModules(),
new AppFabricServiceRuntimeModule(cConf, AppFabricServiceRuntimeModule.ALL_SERVICE_TYPES)
.getInMemoryModules(),
new MonitorHandlerModule(false),
new AuthenticationContextModules().getMasterModule(),
new AuthorizationModule(),
Expand Down

0 comments on commit d1a8b10

Please sign in to comment.