use of io.cdap.cdap.internal.app.runtime.schedule.ProgramScheduleMeta in project cdap by caskdata.
the class ProgramScheduleStoreDataset method extractMetaFromRow.
/**
* Reads the meta data from a row in the schedule store.
*
* @throws IllegalStateException if one of the expected fields is missing or ill-formed.
*/
private ProgramScheduleMeta extractMetaFromRow(ScheduleId scheduleId, StructuredRow row) {
Long updatedTime = row.getLong(StoreDefinition.ProgramScheduleStore.UPDATE_TIME);
String statusString = row.getString(StoreDefinition.ProgramScheduleStore.STATUS);
try {
Preconditions.checkArgument(updatedTime != null, "Last-updated timestamp is null");
Preconditions.checkArgument(statusString != null, "schedule status is null");
ProgramScheduleStatus status = ProgramScheduleStatus.valueOf(statusString);
return new ProgramScheduleMeta(status, updatedTime);
} catch (IllegalArgumentException e) {
throw new IllegalStateException(String.format("Unexpected stored meta data for schedule %s: %s", scheduleId, e.getMessage()));
}
}
Aggregations