use of org.apache.flink.client.program.ProgramInvocationException in project flink by apache.
the class ScalaShellRemoteStreamEnvironment method executeRemotely.
/**
* Executes the remote job.
*
* @param streamGraph
* Stream Graph to execute
* @param jarFiles
* List of jar file URLs to ship to the cluster
* @return The result of the job execution, containing elapsed time and accumulators.
*/
@Override
protected JobExecutionResult executeRemotely(StreamGraph streamGraph, List<URL> jarFiles) throws ProgramInvocationException {
URL jarUrl;
try {
jarUrl = flinkILoop.writeFilesToDisk().getAbsoluteFile().toURI().toURL();
} catch (MalformedURLException e) {
throw new ProgramInvocationException("Could not write the user code classes to disk.", e);
}
List<URL> allJarFiles = new ArrayList<>(jarFiles.size() + 1);
allJarFiles.addAll(jarFiles);
allJarFiles.add(jarUrl);
return super.executeRemotely(streamGraph, allJarFiles);
}
use of org.apache.flink.client.program.ProgramInvocationException in project flink by apache.
the class RemoteStreamEnvironment method executeRemotely.
/**
* Executes the remote job.
*
* @param streamGraph
* Stream Graph to execute
* @param jarFiles
* List of jar file URLs to ship to the cluster
* @return The result of the job execution, containing elapsed time and accumulators.
*/
protected JobExecutionResult executeRemotely(StreamGraph streamGraph, List<URL> jarFiles) throws ProgramInvocationException {
if (LOG.isInfoEnabled()) {
LOG.info("Running remotely at {}:{}", host, port);
}
ClassLoader usercodeClassLoader = JobWithJars.buildUserCodeClassLoader(jarFiles, globalClasspaths, getClass().getClassLoader());
Configuration configuration = new Configuration();
configuration.addAll(this.clientConfiguration);
configuration.setString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY, host);
configuration.setInteger(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, port);
ClusterClient client;
try {
client = new StandaloneClusterClient(configuration);
client.setPrintStatusDuringExecution(getConfig().isSysoutLoggingEnabled());
} catch (Exception e) {
throw new ProgramInvocationException("Cannot establish connection to JobManager: " + e.getMessage(), e);
}
try {
return client.run(streamGraph, jarFiles, globalClasspaths, usercodeClassLoader).getJobExecutionResult();
} catch (ProgramInvocationException e) {
throw e;
} catch (Exception e) {
String term = e.getMessage() == null ? "." : (": " + e.getMessage());
throw new ProgramInvocationException("The program execution failed" + term, e);
} finally {
client.shutdown();
}
}
use of org.apache.flink.client.program.ProgramInvocationException in project flink by apache.
the class CustomSerializationITCase method testIncorrectSerializer4.
@Test
public void testIncorrectSerializer4() {
try {
ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment("localhost", cluster.getLeaderRPCPort());
env.setParallelism(PARLLELISM);
env.getConfig().disableSysoutLogging();
env.generateSequence(1, 10 * PARLLELISM).map(new MapFunction<Long, ConsumesTooLittleSpanning>() {
@Override
public ConsumesTooLittleSpanning map(Long value) throws Exception {
return new ConsumesTooLittleSpanning();
}
}).rebalance().output(new DiscardingOutputFormat<ConsumesTooLittleSpanning>());
env.execute();
} catch (ProgramInvocationException e) {
Throwable rootCause = e.getCause().getCause();
assertTrue(rootCause instanceof IOException);
assertTrue(rootCause.getMessage().contains("broken serialization"));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.client.program.ProgramInvocationException in project flink by apache.
the class CustomSerializationITCase method testIncorrectSerializer1.
@Test
public void testIncorrectSerializer1() {
try {
ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment("localhost", cluster.getLeaderRPCPort());
env.setParallelism(PARLLELISM);
env.getConfig().disableSysoutLogging();
env.generateSequence(1, 10 * PARLLELISM).map(new MapFunction<Long, ConsumesTooMuch>() {
@Override
public ConsumesTooMuch map(Long value) throws Exception {
return new ConsumesTooMuch();
}
}).rebalance().output(new DiscardingOutputFormat<ConsumesTooMuch>());
env.execute();
} catch (ProgramInvocationException e) {
Throwable rootCause = e.getCause().getCause();
assertTrue(rootCause instanceof IOException);
assertTrue(rootCause.getMessage().contains("broken serialization"));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.client.program.ProgramInvocationException in project flink by apache.
the class CustomSerializationITCase method testIncorrectSerializer3.
@Test
public void testIncorrectSerializer3() {
try {
ExecutionEnvironment env = ExecutionEnvironment.createRemoteEnvironment("localhost", cluster.getLeaderRPCPort());
env.setParallelism(PARLLELISM);
env.getConfig().disableSysoutLogging();
env.generateSequence(1, 10 * PARLLELISM).map(new MapFunction<Long, ConsumesTooLittle>() {
@Override
public ConsumesTooLittle map(Long value) throws Exception {
return new ConsumesTooLittle();
}
}).rebalance().output(new DiscardingOutputFormat<ConsumesTooLittle>());
env.execute();
} catch (ProgramInvocationException e) {
Throwable rootCause = e.getCause().getCause();
assertTrue(rootCause instanceof IOException);
assertTrue(rootCause.getMessage().contains("broken serialization"));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations