use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class SavepointWriterWindowITCase method submitJob.
private void submitJob(String savepointPath, StreamExecutionEnvironment sEnv) {
JobGraph jobGraph = sEnv.getStreamGraph().getJobGraph();
jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPath, true));
ClusterClient<?> client = MINI_CLUSTER_RESOURCE.getClusterClient();
try {
Optional<SerializedThrowable> serializedThrowable = client.submitJob(jobGraph).thenCompose(client::requestJobResult).get().getSerializedThrowable();
Assert.assertFalse(serializedThrowable.isPresent());
} catch (Throwable t) {
Assert.fail("Failed to submit job");
}
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class WritableSavepointITCase method validateBootstrap.
private void validateBootstrap(StateBackend backend, String savepointPath) throws Exception {
StreamExecutionEnvironment sEnv = StreamExecutionEnvironment.getExecutionEnvironment();
sEnv.setStateBackend(backend);
DataStream<Account> stream = sEnv.fromCollection(accounts).keyBy(acc -> acc.id).flatMap(new UpdateAndGetAccount()).uid(ACCOUNT_UID);
CompletableFuture<Collection<Account>> results = collector.collect(stream);
sEnv.fromCollection(currencyRates).connect(sEnv.fromCollection(currencyRates).broadcast(descriptor)).process(new CurrencyValidationFunction()).uid(CURRENCY_UID).addSink(new DiscardingSink<>());
JobGraph jobGraph = sEnv.getStreamGraph().getJobGraph();
jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPath, false));
ClusterClient<?> client = MINI_CLUSTER_RESOURCE.getClusterClient();
Optional<SerializedThrowable> serializedThrowable = client.submitJob(jobGraph).thenCompose(client::requestJobResult).get().getSerializedThrowable();
serializedThrowable.ifPresent(t -> {
throw new AssertionError("Unexpected exception during bootstrapping", t);
});
Assert.assertEquals("Unexpected output", 3, results.get().size());
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class WritableSavepointWindowITCase method submitJob.
private void submitJob(String savepointPath, StreamExecutionEnvironment sEnv) {
JobGraph jobGraph = sEnv.getStreamGraph().getJobGraph();
jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPath, true));
ClusterClient<?> client = MINI_CLUSTER_RESOURCE.getClusterClient();
try {
Optional<SerializedThrowable> serializedThrowable = client.submitJob(jobGraph).thenCompose(client::requestJobResult).get().getSerializedThrowable();
Assert.assertFalse(serializedThrowable.isPresent());
} catch (Throwable t) {
Assert.fail("Failed to submit job");
}
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class SavepointWriterITCase method validateBootstrap.
private void validateBootstrap(StateBackend backend, String savepointPath) throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
if (backend != null) {
env.setStateBackend(backend);
}
DataStream<Account> stream = env.fromCollection(accounts).keyBy(acc -> acc.id).flatMap(new UpdateAndGetAccount()).uid(ACCOUNT_UID);
CompletableFuture<Collection<Account>> results = collector.collect(stream);
env.fromCollection(currencyRates).connect(env.fromCollection(currencyRates).broadcast(descriptor)).process(new CurrencyValidationFunction()).uid(CURRENCY_UID).addSink(new DiscardingSink<>());
JobGraph jobGraph = env.getStreamGraph().getJobGraph();
jobGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(savepointPath, false));
ClusterClient<?> client = MINI_CLUSTER_RESOURCE.getClusterClient();
Optional<SerializedThrowable> serializedThrowable = client.submitJob(jobGraph).thenCompose(client::requestJobResult).get().getSerializedThrowable();
serializedThrowable.ifPresent(t -> {
throw new AssertionError("Unexpected exception during bootstrapping", t);
});
Assert.assertEquals("Unexpected output", 3, results.get().size());
}
use of org.apache.flink.util.SerializedThrowable in project flink by apache.
the class DefaultJobMasterServiceProcessTest method assertInitializationException.
private static void assertInitializationException(SerializedThrowable actualException, Throwable expectedCause, long actualTimestamp, long expectedLowerTimestampThreshold, long expectedUpperTimestampThreshold) {
final Throwable deserializedException = actualException.deserializeError(Thread.currentThread().getContextClassLoader());
assertThat(deserializedException).isInstanceOf(JobInitializationException.class).hasCause(expectedCause);
assertThat(actualTimestamp).isGreaterThanOrEqualTo(expectedLowerTimestampThreshold).isLessThanOrEqualTo(expectedUpperTimestampThreshold);
}
Aggregations