Search in sources :

Example 11 with ProgramScheduleRecord

use of io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleRecord in project cdap by caskdata.

the class ProgramLifecycleHttpHandler method doGetSchedule.

private void doGetSchedule(HttpResponder responder, String namespace, String app, String version, String scheduleName) throws Exception {
    ScheduleId scheduleId = new ApplicationId(namespace, app, version).schedule(scheduleName);
    ProgramScheduleRecord record = programScheduleService.getRecord(scheduleId);
    ScheduleDetail detail = record.toScheduleDetail();
    responder.sendJson(HttpResponseStatus.OK, GSON.toJson(detail, ScheduleDetail.class));
}
Also used : ProgramScheduleRecord(io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleRecord) ScheduleDetail(io.cdap.cdap.proto.ScheduleDetail) ScheduleId(io.cdap.cdap.proto.id.ScheduleId) ApplicationId(io.cdap.cdap.proto.id.ApplicationId)

Example 12 with ProgramScheduleRecord

use of io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleRecord in project cdap by caskdata.

the class LocalScheduleFetcher method list.

@Override
public List<ScheduleDetail> list(ProgramId programId) throws IOException, ProgramNotFoundException {
    Predicate<ProgramScheduleRecord> predicate = (record) -> true;
    Collection<ProgramScheduleRecord> schedules = null;
    try {
        schedules = programScheduleService.list(programId, predicate);
    } catch (Exception e) {
        Throwables.propagateIfPossible(e.getCause(), IOException.class, ProgramNotFoundException.class);
        throw new IOException(e);
    }
    return schedules.stream().map(ProgramScheduleRecord::toScheduleDetail).collect(Collectors.toList());
}
Also used : Predicate(java.util.function.Predicate) Inject(com.google.inject.Inject) ProgramScheduleService(io.cdap.cdap.scheduler.ProgramScheduleService) Collection(java.util.Collection) ScheduleNotFoundException(io.cdap.cdap.internal.app.runtime.schedule.ScheduleNotFoundException) ProgramId(io.cdap.cdap.proto.id.ProgramId) Throwables(com.google.common.base.Throwables) IOException(java.io.IOException) ProgramScheduleRecord(io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleRecord) Collectors(java.util.stream.Collectors) ProgramNotFoundException(io.cdap.cdap.common.ProgramNotFoundException) List(java.util.List) ScheduleId(io.cdap.cdap.proto.id.ScheduleId) NotFoundException(io.cdap.cdap.common.NotFoundException) ScheduleDetail(io.cdap.cdap.proto.ScheduleDetail) ProgramScheduleRecord(io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleRecord) IOException(java.io.IOException) ProgramNotFoundException(io.cdap.cdap.common.ProgramNotFoundException) ScheduleNotFoundException(io.cdap.cdap.internal.app.runtime.schedule.ScheduleNotFoundException) IOException(java.io.IOException) ProgramNotFoundException(io.cdap.cdap.common.ProgramNotFoundException) NotFoundException(io.cdap.cdap.common.NotFoundException)

Aggregations

ProgramScheduleRecord (io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleRecord)12 ProgramSchedule (io.cdap.cdap.internal.app.runtime.schedule.ProgramSchedule)6 ProgramScheduleMeta (io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleMeta)5 NotFoundException (io.cdap.cdap.common.NotFoundException)4 ScheduleId (io.cdap.cdap.proto.id.ScheduleId)4 ArrayList (java.util.ArrayList)4 Notification (io.cdap.cdap.proto.Notification)3 ScheduleDetail (io.cdap.cdap.proto.ScheduleDetail)3 Throwables (com.google.common.base.Throwables)2 Inject (com.google.inject.Inject)2 Trigger (io.cdap.cdap.api.schedule.Trigger)2 ProgramStatusTrigger (io.cdap.cdap.internal.app.runtime.schedule.trigger.ProgramStatusTrigger)2 SatisfiableTrigger (io.cdap.cdap.internal.app.runtime.schedule.trigger.SatisfiableTrigger)2 ApplicationId (io.cdap.cdap.proto.id.ApplicationId)2 ProgramId (io.cdap.cdap.proto.id.ProgramId)2 ProgramScheduleService (io.cdap.cdap.scheduler.ProgramScheduleService)2 StructuredRow (io.cdap.cdap.spi.data.StructuredRow)2 IOException (java.io.IOException)2 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2