Search in sources :

Example 1 with ServiceBasedAppLauncher

use of org.apache.gobblin.runtime.app.ServiceBasedAppLauncher in project incubator-gobblin by apache.

the class OrchestratorTest method setup.

@BeforeClass
public void setup() throws Exception {
    cleanUpDir(TOPOLOGY_SPEC_STORE_DIR);
    cleanUpDir(FLOW_SPEC_STORE_DIR);
    Properties orchestratorProperties = new Properties();
    Properties topologyProperties = new Properties();
    topologyProperties.put("specStore.fs.dir", TOPOLOGY_SPEC_STORE_DIR);
    Properties flowProperties = new Properties();
    flowProperties.put("specStore.fs.dir", FLOW_SPEC_STORE_DIR);
    this.serviceLauncher = new ServiceBasedAppLauncher(orchestratorProperties, "OrchestratorCatalogTest");
    this.topologyCatalog = new TopologyCatalog(ConfigUtils.propertiesToConfig(topologyProperties), Optional.of(logger));
    this.serviceLauncher.addService(topologyCatalog);
    this.flowCatalog = new FlowCatalog(ConfigUtils.propertiesToConfig(flowProperties), Optional.of(logger));
    this.serviceLauncher.addService(flowCatalog);
    this.orchestrator = new Orchestrator(ConfigUtils.propertiesToConfig(orchestratorProperties), Optional.of(this.topologyCatalog), Optional.of(logger));
    this.topologyCatalog.addListener(orchestrator);
    this.flowCatalog.addListener(orchestrator);
    // Start application
    this.serviceLauncher.start();
    // Create Spec to play with
    this.topologySpec = initTopologySpec();
    this.flowSpec = initFlowSpec();
}
Also used : ServiceBasedAppLauncher(org.apache.gobblin.runtime.app.ServiceBasedAppLauncher) Properties(java.util.Properties) TopologyCatalog(org.apache.gobblin.runtime.spec_catalog.TopologyCatalog) FlowCatalog(org.apache.gobblin.runtime.spec_catalog.FlowCatalog) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with ServiceBasedAppLauncher

use of org.apache.gobblin.runtime.app.ServiceBasedAppLauncher in project incubator-gobblin by apache.

the class FlowCatalogTest method setup.

@BeforeClass
public void setup() throws Exception {
    File specStoreDir = new File(SPEC_STORE_DIR);
    if (specStoreDir.exists()) {
        FileUtils.deleteDirectory(specStoreDir);
    }
    Properties properties = new Properties();
    properties.put("specStore.fs.dir", SPEC_STORE_DIR);
    this.serviceLauncher = new ServiceBasedAppLauncher(properties, "FlowCatalogTest");
    this.flowCatalog = new FlowCatalog(ConfigUtils.propertiesToConfig(properties), Optional.of(logger));
    this.serviceLauncher.addService(flowCatalog);
    // Start Catalog
    this.serviceLauncher.start();
    // Create Spec to play with
    this.flowSpec = initFlowSpec();
}
Also used : ServiceBasedAppLauncher(org.apache.gobblin.runtime.app.ServiceBasedAppLauncher) Properties(java.util.Properties) File(java.io.File) FlowCatalog(org.apache.gobblin.runtime.spec_catalog.FlowCatalog) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with ServiceBasedAppLauncher

use of org.apache.gobblin.runtime.app.ServiceBasedAppLauncher in project incubator-gobblin by apache.

the class TopologyCatalogTest method setup.

@BeforeClass
public void setup() throws Exception {
    File specStoreDir = new File(SPEC_STORE_DIR);
    if (specStoreDir.exists()) {
        FileUtils.deleteDirectory(specStoreDir);
    }
    Properties properties = new Properties();
    properties.put("specStore.fs.dir", SPEC_STORE_DIR);
    this.serviceLauncher = new ServiceBasedAppLauncher(properties, "TopologyCatalogTest");
    this.topologyCatalog = new TopologyCatalog(ConfigUtils.propertiesToConfig(properties), Optional.of(logger));
    this.serviceLauncher.addService(topologyCatalog);
    // Start Catalog
    this.serviceLauncher.start();
    // Create Spec to play with
    this.topologySpec = initTopologySpec();
}
Also used : ServiceBasedAppLauncher(org.apache.gobblin.runtime.app.ServiceBasedAppLauncher) Properties(java.util.Properties) File(java.io.File) TopologyCatalog(org.apache.gobblin.runtime.spec_catalog.TopologyCatalog) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with ServiceBasedAppLauncher

use of org.apache.gobblin.runtime.app.ServiceBasedAppLauncher in project incubator-gobblin by apache.

the class GobblinLocalJobLauncherUtils method invokeLocalJobLauncher.

public static void invokeLocalJobLauncher(Properties properties) throws Exception {
    try (ApplicationLauncher applicationLauncher = new ServiceBasedAppLauncher(properties, properties.getProperty(ServiceBasedAppLauncher.APP_NAME, "CliLocalJob-" + UUID.randomUUID()))) {
        applicationLauncher.start();
        try (LocalJobLauncher localJobLauncher = new LocalJobLauncher(properties)) {
            localJobLauncher.launchJob(null);
        }
        applicationLauncher.stop();
    }
}
Also used : ServiceBasedAppLauncher(org.apache.gobblin.runtime.app.ServiceBasedAppLauncher) ApplicationLauncher(org.apache.gobblin.runtime.app.ApplicationLauncher) LocalJobLauncher(org.apache.gobblin.runtime.local.LocalJobLauncher)

Example 5 with ServiceBasedAppLauncher

use of org.apache.gobblin.runtime.app.ServiceBasedAppLauncher in project incubator-gobblin by apache.

the class GobblinClusterManager method initializeAppLauncherAndServices.

/**
 * Create the service based application launcher and other associated services
 * @throws Exception
 */
private void initializeAppLauncherAndServices() throws Exception {
    // Done to preserve backwards compatibility with the previously hard-coded timeout of 5 minutes
    Properties properties = ConfigUtils.configToProperties(this.config);
    if (!properties.contains(ServiceBasedAppLauncher.APP_STOP_TIME_SECONDS)) {
        properties.setProperty(ServiceBasedAppLauncher.APP_STOP_TIME_SECONDS, Long.toString(300));
    }
    this.applicationLauncher = new ServiceBasedAppLauncher(properties, this.clusterName);
    // create a job catalog for keeping track of received jobs if a job config path is specified
    if (this.config.hasPath(GobblinClusterConfigurationKeys.GOBBLIN_CLUSTER_PREFIX + ConfigurationKeys.JOB_CONFIG_FILE_GENERAL_PATH_KEY)) {
        String jobCatalogClassName = ConfigUtils.getString(config, GobblinClusterConfigurationKeys.JOB_CATALOG_KEY, GobblinClusterConfigurationKeys.DEFAULT_JOB_CATALOG);
        this.jobCatalog = (MutableJobCatalog) GobblinConstructorUtils.invokeFirstConstructor(Class.forName(jobCatalogClassName), ImmutableList.<Object>of(config.getConfig(StringUtils.removeEnd(GobblinClusterConfigurationKeys.GOBBLIN_CLUSTER_PREFIX, ".")).withFallback(this.config)));
    } else {
        this.jobCatalog = null;
    }
    SchedulerService schedulerService = new SchedulerService(properties);
    this.applicationLauncher.addService(schedulerService);
    this.jobScheduler = buildGobblinHelixJobScheduler(config, this.appWorkDir, getMetadataTags(clusterName, applicationId), schedulerService);
    this.applicationLauncher.addService(this.jobScheduler);
    this.jobConfigurationManager = buildJobConfigurationManager(config);
    this.applicationLauncher.addService(this.jobConfigurationManager);
}
Also used : ServiceBasedAppLauncher(org.apache.gobblin.runtime.app.ServiceBasedAppLauncher) SchedulerService(org.apache.gobblin.scheduler.SchedulerService) Properties(java.util.Properties)

Aggregations

ServiceBasedAppLauncher (org.apache.gobblin.runtime.app.ServiceBasedAppLauncher)5 Properties (java.util.Properties)4 BeforeClass (org.testng.annotations.BeforeClass)3 File (java.io.File)2 FlowCatalog (org.apache.gobblin.runtime.spec_catalog.FlowCatalog)2 TopologyCatalog (org.apache.gobblin.runtime.spec_catalog.TopologyCatalog)2 ApplicationLauncher (org.apache.gobblin.runtime.app.ApplicationLauncher)1 LocalJobLauncher (org.apache.gobblin.runtime.local.LocalJobLauncher)1 SchedulerService (org.apache.gobblin.scheduler.SchedulerService)1