Search in sources :

Example 1 with ScheduleBuilder

use of co.cask.cdap.api.schedule.ScheduleBuilder in project cdap by caskdata.

the class DataPipelineApp method configure.

@Override
public void configure() {
    ETLBatchConfig config = getConfig();
    setDescription(Objects.firstNonNull(config.getDescription(), DEFAULT_DESCRIPTION));
    BatchPipelineSpec spec = new BatchPipelineSpecGenerator<>(getConfigurer(), ImmutableSet.of(BatchSource.PLUGIN_TYPE), ImmutableSet.of(BatchSink.PLUGIN_TYPE, SparkSink.PLUGIN_TYPE, AlertPublisher.PLUGIN_TYPE), config.getEngine()).generateSpec(config);
    addWorkflow(new SmartWorkflow(spec, supportedPluginTypes, getConfigurer(), config.getEngine()));
    ScheduleBuilder scheduleBuilder = buildSchedule(SCHEDULE_NAME, ProgramType.WORKFLOW, SmartWorkflow.NAME).setDescription("Data pipeline schedule");
    Integer maxConcurrentRuns = config.getMaxConcurrentRuns();
    if (maxConcurrentRuns != null) {
        scheduleBuilder.withConcurrency(maxConcurrentRuns);
    }
    schedule(scheduleBuilder.triggerByTime(config.getSchedule()));
}
Also used : ETLBatchConfig(co.cask.cdap.etl.proto.v2.ETLBatchConfig) BatchPipelineSpec(co.cask.cdap.etl.batch.BatchPipelineSpec) ScheduleBuilder(co.cask.cdap.api.schedule.ScheduleBuilder)

Aggregations

ScheduleBuilder (co.cask.cdap.api.schedule.ScheduleBuilder)1 BatchPipelineSpec (co.cask.cdap.etl.batch.BatchPipelineSpec)1 ETLBatchConfig (co.cask.cdap.etl.proto.v2.ETLBatchConfig)1