Search in sources :

Example 1 with QueryManager

use of edu.snu.mist.core.task.QueryManager in project mist by snuspl.

the class DefaultCheckpointManagerImpl method recoverGroup.

@Override
public void recoverGroup(final String groupId) throws IOException {
    final 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();
        final List<String> queryIdListInGroup = new ArrayList<>();
        for (final String queryId : queryCheckpointMap.keySet()) {
            queryIdListInGroup.add(queryId);
        }
        // Load the queries.
        dagList = checkpointStore.loadSavedQueries(queryIdListInGroup);
    } catch (final FileNotFoundException ie) {
        LOG.log(Level.WARNING, "Failed in loading group {0}, this group may not exist in the checkpoint store.", new Object[] { groupId });
        return;
    }
    for (final AvroDag avroDag : dagList) {
        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) QueryManager(edu.snu.mist.core.task.QueryManager) ArrayList(java.util.ArrayList) 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 ArrayList (java.util.ArrayList)1