public static Savepoint loadSavepoint(String checkpointPointer) { try { Method resolveCheckpointPointer = AbstractFsCheckpointStorage.class.getDeclaredMethod( "resolveCheckpointPointer", String.class); resolveCheckpointPointer.setAccessible(true); CompletedCheckpointStorageLocation loc = (CompletedCheckpointStorageLocation) resolveCheckpointPointer .invoke(null, checkpointPointer); return Checkpoints.loadCheckpointMetadata(new DataInputStream(loc.getMetadataHandle().openInputStream()), BravoTestPipeline.class.getClassLoader()); } catch (Exception e) { throw new RuntimeException(e); } }
public static <T extends Savepoint> void storeCheckpointMetadata( T checkpointMetadata, DataOutputStream out) throws IOException { // write generic header out.writeInt(HEADER_MAGIC_NUMBER); out.writeInt(checkpointMetadata.getVersion()); // write checkpoint metadata SavepointSerializer<T> serializer = SavepointSerializers.getSerializer(checkpointMetadata); serializer.serialize(checkpointMetadata, out); }
public static void disposeSavepoint( String pointer, Configuration configuration, ClassLoader classLoader, @Nullable Logger logger) throws IOException, FlinkException { checkNotNull(pointer, "location"); checkNotNull(configuration, "configuration"); checkNotNull(classLoader, "classLoader"); StateBackend backend = loadStateBackend(configuration, classLoader, logger); disposeSavepoint(pointer, backend, classLoader); }
/** * Dispose the savepoint stored under the given path. * * @param savepointPath path where the savepoint is stored */ private void disposeSavepoint(String savepointPath) { try { // delete the temporary savepoint Checkpoints.disposeSavepoint( savepointPath, jobMasterConfiguration.getConfiguration(), userCodeLoader, log); } catch (FlinkException | IOException e) { log.info("Could not dispose temporary rescaling savepoint under {}.", savepointPath, e); } }
CompletedCheckpoint savepoint = Checkpoints.loadAndValidateCheckpoint( job, tasks, checkpointLocation, userClassLoader, allowNonRestored);
/** * Dispose the savepoint stored under the given path. * * @param savepointPath path where the savepoint is stored */ private void disposeSavepoint(String savepointPath) { try { // delete the temporary savepoint Checkpoints.disposeSavepoint( savepointPath, jobMasterConfiguration.getConfiguration(), userCodeLoader, log); } catch (FlinkException | IOException e) { log.info("Could not dispose temporary rescaling savepoint under {}.", savepointPath, e); } }
CompletedCheckpoint savepoint = Checkpoints.loadAndValidateCheckpoint( job, tasks, checkpointLocation, userClassLoader, allowNonRestored);
/** * Load the Savepoint metadata object from the given path */ public static Savepoint loadSavepoint(String checkpointPointer) throws IOException { try { Method resolveCheckpointPointer = AbstractFsCheckpointStorage.class.getDeclaredMethod( "resolveCheckpointPointer", String.class); resolveCheckpointPointer.setAccessible(true); CompletedCheckpointStorageLocation loc = (CompletedCheckpointStorageLocation) resolveCheckpointPointer .invoke(null, checkpointPointer); return Checkpoints.loadCheckpointMetadata(new DataInputStream(loc.getMetadataHandle().openInputStream()), StateMetadataUtils.class.getClassLoader()); } catch (Exception e) { throw new RuntimeException(e); } }
public static <T extends Savepoint> void storeCheckpointMetadata( T checkpointMetadata, DataOutputStream out) throws IOException { // write generic header out.writeInt(HEADER_MAGIC_NUMBER); out.writeInt(checkpointMetadata.getVersion()); // write checkpoint metadata SavepointSerializer<T> serializer = SavepointSerializers.getSerializer(checkpointMetadata); serializer.serialize(checkpointMetadata, out); }
public static void disposeSavepoint( String pointer, Configuration configuration, ClassLoader classLoader, @Nullable Logger logger) throws IOException, FlinkException { checkNotNull(pointer, "location"); checkNotNull(configuration, "configuration"); checkNotNull(classLoader, "classLoader"); StateBackend backend = loadStateBackend(configuration, classLoader, logger); disposeSavepoint(pointer, backend, classLoader); }
/** * Dispose the savepoint stored under the given path. * * @param savepointPath path where the savepoint is stored */ private void disposeSavepoint(String savepointPath) { try { // delete the temporary savepoint Checkpoints.disposeSavepoint( savepointPath, jobMasterConfiguration.getConfiguration(), userCodeLoader, log); } catch (FlinkException | IOException e) { log.info("Could not dispose temporary rescaling savepoint under {}.", savepointPath, e); } }
CompletedCheckpoint savepoint = Checkpoints.loadAndValidateCheckpoint( job, tasks, checkpointLocation, userClassLoader, allowNonRestored, convertToSavepoint);
try (InputStream in = metadataHandle.openInputStream()) { DataInputStream dis = new DataInputStream(in); rawCheckpointMetadata = loadCheckpointMetadata(dis, classLoader);
public static <T extends Savepoint> void storeCheckpointMetadata( T checkpointMetadata, DataOutputStream out) throws IOException { // write generic header out.writeInt(HEADER_MAGIC_NUMBER); out.writeInt(checkpointMetadata.getVersion()); // write checkpoint metadata SavepointSerializer<T> serializer = SavepointSerializers.getSerializer(checkpointMetadata); serializer.serialize(checkpointMetadata, out); }
public static void disposeSavepoint( String pointer, Configuration configuration, ClassLoader classLoader, @Nullable Logger logger) throws IOException, FlinkException { checkNotNull(pointer, "location"); checkNotNull(configuration, "configuration"); checkNotNull(classLoader, "classLoader"); StateBackend backend = loadStateBackend(configuration, classLoader, logger); disposeSavepoint(pointer, backend, classLoader); }
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath, Time timeout) { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return CompletableFuture.supplyAsync( () -> { log.info("Disposing savepoint {}.", savepointPath); try { Checkpoints.disposeSavepoint(savepointPath, configuration, classLoader, log); } catch (IOException | FlinkException e) { throw new CompletionException(new FlinkException(String.format("Could not dispose savepoint %s.", savepointPath), e)); } return Acknowledge.get(); }, jobManagerSharedServices.getScheduledExecutorService()); }
try (InputStream in = metadataHandle.openInputStream()) { DataInputStream dis = new DataInputStream(in); rawCheckpointMetadata = loadCheckpointMetadata(dis, classLoader);
public static Path writeSavepointMetadata(Path newCheckpointBasePath, Savepoint savepoint) throws IOException { Path p = new Path(newCheckpointBasePath, AbstractFsCheckpointStorage.METADATA_FILE_NAME); Checkpoints.storeCheckpointMetadata(savepoint, newCheckpointBasePath.getFileSystem().create(p, WriteMode.NO_OVERWRITE)); return p; }
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath, Time timeout) { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return CompletableFuture.supplyAsync( () -> { log.info("Disposing savepoint {}.", savepointPath); try { Checkpoints.disposeSavepoint(savepointPath, configuration, classLoader, log); } catch (IOException | FlinkException e) { throw new CompletionException(new FlinkException(String.format("Could not dispose savepoint %s.", savepointPath), e)); } return Acknowledge.get(); }, jobManagerSharedServices.getScheduledExecutorService()); }
try (InputStream in = metadataHandle.openInputStream()) { DataInputStream dis = new DataInputStream(in); rawCheckpointMetadata = loadCheckpointMetadata(dis, classLoader);