org.apache.flink.client.program.JobWithJars Java Examples
The following examples show how to use
org.apache.flink.client.program.JobWithJars.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AvroExternalJarProgramITCase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testExternalProgram() throws Exception { String jarFile = JAR_FILE; try { JobWithJars.checkJarFile(new File(jarFile).getAbsoluteFile().toURI().toURL()); } catch (IOException e) { jarFile = "target/".concat(jarFile); } TestEnvironment.setAsContext( MINI_CLUSTER, PARALLELISM, Collections.singleton(new Path(jarFile)), Collections.emptyList()); String testData = getClass().getResource(TEST_DATA_FILE).toString(); PackagedProgram program = new PackagedProgram(new File(jarFile), new String[]{testData}); program.invokeInteractiveModeForExecution(); }
Example #2
Source File: AvroExternalJarProgramITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testExternalProgram() throws Exception { String jarFile = JAR_FILE; try { JobWithJars.checkJarFile(new File(jarFile).getAbsoluteFile().toURI().toURL()); } catch (IOException e) { jarFile = "target/".concat(jarFile); } TestEnvironment.setAsContext( MINI_CLUSTER, PARALLELISM, Collections.singleton(new Path(jarFile)), Collections.emptyList()); String testData = getClass().getResource(TEST_DATA_FILE).toString(); PackagedProgram program = new PackagedProgram(new File(jarFile), new String[]{testData}); program.invokeInteractiveModeForExecution(); }
Example #3
Source File: RemoteExecutor.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public JobExecutionResult executePlan(Plan plan) throws Exception { if (plan == null) { throw new IllegalArgumentException("The plan may not be null."); } JobWithJars p = new JobWithJars(plan, this.jarFiles, this.globalClasspaths); return executePlanWithJars(p); }
Example #4
Source File: RemoteExecutor.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public JobExecutionResult executePlanWithJars(JobWithJars program) throws Exception { if (program == null) { throw new IllegalArgumentException("The job may not be null."); } synchronized (this.lock) { // check if we start a session dedicated for this execution final boolean shutDownAtEnd; if (client == null) { shutDownAtEnd = true; // start the executor for us start(); } else { // we use the existing session shutDownAtEnd = false; } try { return client.run(program, defaultParallelism).getJobExecutionResult(); } finally { if (shutDownAtEnd) { stop(); } } } }
Example #5
Source File: RemoteExecutor.java From flink with Apache License 2.0 | 5 votes |
@Override public JobExecutionResult executePlan(Plan plan) throws Exception { if (plan == null) { throw new IllegalArgumentException("The plan may not be null."); } JobWithJars p = new JobWithJars(plan, this.jarFiles, this.globalClasspaths); return executePlanWithJars(p); }
Example #6
Source File: RemoteExecutor.java From flink with Apache License 2.0 | 5 votes |
public JobExecutionResult executePlanWithJars(JobWithJars program) throws Exception { if (program == null) { throw new IllegalArgumentException("The job may not be null."); } synchronized (this.lock) { // check if we start a session dedicated for this execution final boolean shutDownAtEnd; if (client == null) { shutDownAtEnd = true; // start the executor for us start(); } else { // we use the existing session shutDownAtEnd = false; } try { return client.run(program, defaultParallelism).getJobExecutionResult(); } finally { if (shutDownAtEnd) { stop(); } } } }