use of com.thinkbiganalytics.spark.service.TransformService in project kylo by Teradata.
the class KyloShellConfig method transformService.
/**
* Gets the transform service.
*
* @param transformScriptClass the transform script class
* @param engine the Spark script engine
* @param sparkContextService the Spark context service
* @param tracker the transform job tracker
* @param datasourceProviderFactory the data source provider factory
* @param profiler the profiler
* @return the transform service
*/
@Bean
public TransformService transformService(final Class<? extends TransformScript> transformScriptClass, final SparkScriptEngine engine, final SparkContextService sparkContextService, final JobTrackerService tracker, final DatasourceProviderFactory datasourceProviderFactory, final Profiler profiler, final DataValidator validator, final FileSystem fileSystem, final DataSetConverterService converterService, final KyloCatalogClientBuilder kyloCatalogClientBuilder, final CatalogDataSetProviderFactory catalogDataSetProviderFactory) {
final TransformService service = new TransformService(transformScriptClass, engine, sparkContextService, tracker, converterService, kyloCatalogClientBuilder);
service.setDatasourceProviderFactory(datasourceProviderFactory);
service.setFileSystem(fileSystem);
service.setProfiler(profiler);
service.setValidator(validator);
service.setCatalogDataSetProviderFactory(catalogDataSetProviderFactory);
return service;
}
use of com.thinkbiganalytics.spark.service.TransformService in project kylo by Teradata.
the class KyloShellConfig method jerseyConfig.
/**
* Gets the resource configuration for setting up Jersey.
*
* @return the Jersey configuration
*/
@Bean
public ResourceConfig jerseyConfig(final TransformService transformService, final FileSystem fileSystem, final SparkLocatorService sparkLocatorService, final SparkUtilityService sparkUtilityService) {
Validate.notNull(fileSystem);
Validate.notNull(transformService);
Validate.notNull(sparkLocatorService);
Validate.notNull(sparkUtilityService);
final ResourceConfig config = new ResourceConfig(ApiListingResource.class, SwaggerSerializers.class);
config.packages("com.thinkbiganalytics.spark.rest");
config.register(new AbstractBinder() {
@Override
protected void configure() {
bind(fileSystem).to(FileSystem.class);
bind(transformService).to(TransformService.class);
bind(sparkLocatorService).to(SparkLocatorService.class);
bind(sparkUtilityService).to(SparkUtilityService.class);
}
});
return config;
}
use of com.thinkbiganalytics.spark.service.TransformService in project kylo by Teradata.
the class SparkShellTransformControllerTest method createWithScriptException.
/**
* Verify response if a script exception is thrown.
*/
@Test
public void createWithScriptException() throws Exception {
// Create transform objects
TransformRequest request = new TransformRequest();
request.setScript("sqlContext.sql(\"SELECT * FROM invalid\")");
TransformService transformService = Mockito.mock(TransformService.class);
Mockito.when(transformService.execute(request)).thenThrow(new ScriptException("Invalid script"));
// Test script exception
SparkShellTransformController controller = new SparkShellTransformController();
controller.transformService = transformService;
Response response = controller.create(request);
Assert.assertEquals(Response.Status.INTERNAL_SERVER_ERROR, response.getStatusInfo());
TransformResponse entity = (TransformResponse) response.getEntity();
Assert.assertEquals("Invalid script", entity.getMessage());
Assert.assertEquals(TransformResponse.Status.ERROR, entity.getStatus());
}
use of com.thinkbiganalytics.spark.service.TransformService in project kylo by Teradata.
the class SparkShellApp method jerseyConfig.
/**
* Gets the resource configuration for setting up Jersey.
*
* @return the Jersey configuration
*/
@Bean
public ResourceConfig jerseyConfig(final TransformService transformService, final FileSystem fileSystem, final SparkLocatorService sparkLocatorService) {
final ResourceConfig config = new ResourceConfig(ApiListingResource.class, SwaggerSerializers.class);
config.packages("com.thinkbiganalytics.spark.rest");
config.register(new AbstractBinder() {
@Override
protected void configure() {
bind(fileSystem).to(FileSystem.class);
bind(transformService).to(TransformService.class);
bind(sparkLocatorService).to(SparkLocatorService.class);
}
});
return config;
}
use of com.thinkbiganalytics.spark.service.TransformService in project kylo by Teradata.
the class SparkShellApp method transformService.
/**
* Gets the transform service.
*
* @param transformScriptClass the transform script class
* @param engine the Spark script engine
* @param sparkContextService the Spark context service
* @param tracker the transform job tracker
* @param datasourceProviderFactory the data source provider factory
* @param profiler the profiler
* @return the transform service
*/
@Bean
public TransformService transformService(final Class<? extends TransformScript> transformScriptClass, final SparkScriptEngine engine, final SparkContextService sparkContextService, final JobTrackerService tracker, final DatasourceProviderFactory datasourceProviderFactory, final Profiler profiler, final DataValidator validator, final FileSystem fileSystem) {
final TransformService service = new TransformService(transformScriptClass, engine, sparkContextService, tracker);
service.setDatasourceProviderFactory(datasourceProviderFactory);
service.setFileSystem(fileSystem);
service.setProfiler(profiler);
service.setValidator(validator);
return service;
}
Aggregations