Search in sources :

Example 1 with QueryCheckpoint

use of edu.snu.mist.formats.avro.QueryCheckpoint in project mist by snuspl.

the class DefaultCheckpointManagerImpl method recoverGroup.

@Override
public void recoverGroup(final String groupId) throws IOException {
    Map<String, QueryCheckpoint> queryCheckpointMap;
    final List<AvroDag> dagList;
    final QueryManager queryManager = queryManagerFuture.get();
    try {
        // Load the checkpointed states and the query lists.
        queryCheckpointMap = checkpointStore.loadSavedGroupState(groupId).getQueryCheckpointMap();
    // Load the queries.
    } catch (final FileNotFoundException ie) {
        LOG.log(Level.WARNING, "Checkpoint is not found for group {0}.", new Object[] { groupId });
        // Insert an empty map to prevent null point exception.
        queryCheckpointMap = new HashMap<>();
    }
    final List<String> queryIdListInGroup = checkpointStore.loadSaveGroupQueryInfo(groupId);
    dagList = checkpointStore.loadSavedQueries(queryIdListInGroup);
    for (final AvroDag avroDag : dagList) {
        // Get the checkpoint for each dag. If there is no checkpoint for the query, it returns null.
        final QueryCheckpoint queryCheckpoint = queryCheckpointMap.get(avroDag.getQueryId());
        // Recover each query in the group.
        queryManager.createQueryWithCheckpoint(avroDag, queryCheckpoint);
    }
}
Also used : AvroDag(edu.snu.mist.formats.avro.AvroDag) HashMap(java.util.HashMap) QueryManager(edu.snu.mist.core.task.QueryManager) FileNotFoundException(java.io.FileNotFoundException) QueryCheckpoint(edu.snu.mist.formats.avro.QueryCheckpoint)

Aggregations

QueryManager (edu.snu.mist.core.task.QueryManager)1 AvroDag (edu.snu.mist.formats.avro.AvroDag)1 QueryCheckpoint (edu.snu.mist.formats.avro.QueryCheckpoint)1 FileNotFoundException (java.io.FileNotFoundException)1 HashMap (java.util.HashMap)1