use of com.hazelcast.jet.impl.execution.SnapshotRecord.SnapshotStatus in project hazelcast-jet by hazelcast.
the class JobCoordinationService method completeSnapshot.
void completeSnapshot(long jobId, long executionId, long snapshotId, boolean isSuccess) {
MasterContext masterContext = masterContexts.get(jobId);
if (masterContext != null) {
try {
SnapshotStatus status = isSuccess ? SUCCESSFUL : FAILED;
long elapsed = snapshotRepository.setSnapshotStatus(jobId, snapshotId, status);
logger.info(String.format("Snapshot %s for job %s completed with status %s in %dms", snapshotId, idToString(jobId), status, elapsed));
} catch (Exception e) {
logger.warning("Cannot update snapshot status for " + jobAndExecutionId(jobId, executionId) + " snapshot " + snapshotId + " isSuccess: " + isSuccess);
return;
}
try {
if (isSuccess) {
snapshotRepository.deleteAllSnapshotsExceptOne(jobId, snapshotId);
} else {
snapshotRepository.deleteSingleSnapshot(jobId, snapshotId);
}
} catch (Exception e) {
logger.warning("Cannot delete old snapshots for " + jobAndExecutionId(jobId, executionId));
}
scheduleSnapshot(jobId, executionId);
} else {
logger.warning("MasterContext not found to finalize snapshot of " + jobAndExecutionId(jobId, executionId) + " with result: " + isSuccess);
}
}
Aggregations