org.apache.flink.runtime.operators.Driver Java Examples

The following examples show how to use org.apache.flink.runtime.operators.Driver. 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: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() {
	final String className = this.config.getString(DRIVER_CLASS, null);
	if (className == null) {
		throw new CorruptConfigurationException("The pact driver class is missing.");
	}
	
	try {
		@SuppressWarnings("unchecked")
		final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class;
		return Class.forName(className).asSubclass(pdClazz);
	} catch (ClassNotFoundException cnfex) {
		throw new CorruptConfigurationException("The given driver class cannot be found.");
	} catch (ClassCastException ccex) {
		throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface.");
	}
}
 
Example #2
Source File: AbstractIterativeTask.java    From flink with Apache License 2.0 6 votes vote down vote up
private void reinstantiateDriver() throws Exception {
	if (this.driver instanceof ResettableDriver) {
		final ResettableDriver<?, ?> resDriver = (ResettableDriver<?, ?>) this.driver;
		resDriver.reset();
	} else {
		Class<? extends Driver<S, OT>> driverClass = this.config.getDriver();
		this.driver = InstantiationUtil.instantiate(driverClass, Driver.class);

		try {
			this.driver.setup(this);
		}
		catch (Throwable t) {
			throw new Exception("The pact driver setup for '" + this.getEnvironment().getTaskInfo().getTaskName() +
					"' , caused an error: " + t.getMessage(), t);
		}
	}
}
 
Example #3
Source File: TaskConfig.java    From flink with Apache License 2.0 6 votes vote down vote up
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() {
	final String className = this.config.getString(DRIVER_CLASS, null);
	if (className == null) {
		throw new CorruptConfigurationException("The pact driver class is missing.");
	}
	
	try {
		@SuppressWarnings("unchecked")
		final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class;
		return Class.forName(className).asSubclass(pdClazz);
	} catch (ClassNotFoundException cnfex) {
		throw new CorruptConfigurationException("The given driver class cannot be found.");
	} catch (ClassCastException ccex) {
		throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface.");
	}
}
 
Example #4
Source File: TaskConfig.java    From flink with Apache License 2.0 6 votes vote down vote up
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() {
	final String className = this.config.getString(DRIVER_CLASS, null);
	if (className == null) {
		throw new CorruptConfigurationException("The pact driver class is missing.");
	}
	
	try {
		@SuppressWarnings("unchecked")
		final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class;
		return Class.forName(className).asSubclass(pdClazz);
	} catch (ClassNotFoundException cnfex) {
		throw new CorruptConfigurationException("The given driver class cannot be found.");
	} catch (ClassCastException ccex) {
		throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface.");
	}
}
 
Example #5
Source File: AbstractIterativeTask.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private void reinstantiateDriver() throws Exception {
	if (this.driver instanceof ResettableDriver) {
		final ResettableDriver<?, ?> resDriver = (ResettableDriver<?, ?>) this.driver;
		resDriver.reset();
	} else {
		Class<? extends Driver<S, OT>> driverClass = this.config.getDriver();
		this.driver = InstantiationUtil.instantiate(driverClass, Driver.class);

		try {
			this.driver.setup(this);
		}
		catch (Throwable t) {
			throw new Exception("The pact driver setup for '" + this.getEnvironment().getTaskInfo().getTaskName() +
					"' , caused an error: " + t.getMessage(), t);
		}
	}
}
 
Example #6
Source File: AbstractIterativeTask.java    From flink with Apache License 2.0 6 votes vote down vote up
private void reinstantiateDriver() throws Exception {
	if (this.driver instanceof ResettableDriver) {
		final ResettableDriver<?, ?> resDriver = (ResettableDriver<?, ?>) this.driver;
		resDriver.reset();
	} else {
		Class<? extends Driver<S, OT>> driverClass = this.config.getDriver();
		this.driver = InstantiationUtil.instantiate(driverClass, Driver.class);

		try {
			this.driver.setup(this);
		}
		catch (Throwable t) {
			throw new Exception("The pact driver setup for '" + this.getEnvironment().getTaskInfo().getTaskName() +
					"' , caused an error: " + t.getMessage(), t);
		}
	}
}
 
Example #7
Source File: TaskTestBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public void registerTask(
		@SuppressWarnings("rawtypes") Class<? extends Driver> driver,
		Class<? extends RichFunction> stubClass) {

	final TaskConfig config = new TaskConfig(this.mockEnv.getTaskConfiguration());
	config.setDriver(driver);
	config.setStubWrapper(new UserCodeClassWrapper<>(stubClass));
}
 
Example #8
Source File: TaskTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
public void registerTask(
		@SuppressWarnings("rawtypes") Class<? extends Driver> driver,
		Class<? extends RichFunction> stubClass) {

	final TaskConfig config = new TaskConfig(this.mockEnv.getTaskConfiguration());
	config.setDriver(driver);
	config.setStubWrapper(new UserCodeClassWrapper<>(stubClass));
}
 
Example #9
Source File: TaskTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
public void registerTask(
		@SuppressWarnings("rawtypes") Class<? extends Driver> driver,
		Class<? extends RichFunction> stubClass) {

	final TaskConfig config = new TaskConfig(this.mockEnv.getTaskConfiguration());
	config.setDriver(driver);
	config.setStubWrapper(new UserCodeClassWrapper<>(stubClass));
}
 
Example #10
Source File: DriverTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #11
Source File: BinaryOperatorTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #12
Source File: UnaryOperatorTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #13
Source File: DriverTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #14
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public void setDriver(@SuppressWarnings("rawtypes") Class<? extends Driver> driver) {
	this.config.setString(DRIVER_CLASS, driver.getName());
}
 
Example #15
Source File: BinaryOperatorTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #16
Source File: UnaryOperatorTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #17
Source File: TaskConfig.java    From flink with Apache License 2.0 4 votes vote down vote up
public void setDriver(@SuppressWarnings("rawtypes") Class<? extends Driver> driver) {
	this.config.setString(DRIVER_CLASS, driver.getName());
}
 
Example #18
Source File: BinaryOperatorTestBase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #19
Source File: UnaryOperatorTestBase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #20
Source File: DriverTestBase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public void testDriver(Driver driver, Class stubClass) throws Exception {
	testDriverInternal(driver, stubClass);
}
 
Example #21
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public void setDriver(@SuppressWarnings("rawtypes") Class<? extends Driver> driver) {
	this.config.setString(DRIVER_CLASS, driver.getName());
}