-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Nadeem Mohammad edited this page Oct 8, 2016
·
7 revisions
To distribute the execution of tasks using Apache Ignite, you have to use IgniteExecutionEngine
, and follow this steps :
<dependency>
<groupId>com.github.dexecutor</groupId>
<artifactId>dexecutor-ignite</artifactId>
<version>LATEST_RELEASE</version>
</dependency>
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName(nodeName);
Ignite ignite = Ignition.start(cfg);
if (isMaster) {
DefaultDependentTasksExecutor<Integer, Integer> dexecutor = newTaskExecutor(ignite.compute());
buildGraph(dexecutor);
dexecutor.execute(ExecutionConfig.TERMINATING);
}
private DefaultDependentTasksExecutor<Integer, Integer> newTaskExecutor(final IgniteCompute igniteCompute) {
DependentTasksExecutorConfig<Integer, Integer> config = new DependentTasksExecutorConfig<Integer, Integer>(
new IgniteExecutionEngine<Integer, Integer>(igniteCompute), new SleepyTaskProvider());
return new DefaultDependentTasksExecutor<Integer, Integer>(config);
}
Open three terminals and execute the following :
mvn test-compile exec:java -Djava.net.preferIPv4Stack=true -Dexec.mainClass="com.github.dexecutor.ignite.Node" -Dexec.classpathScope="test" -Dexec.args="s node-A"
mvn test-compile exec:java -Djava.net.preferIPv4Stack=true -Dexec.mainClass="com.github.dexecutor.ignite.Node" -Dexec.classpathScope="test" -Dexec.args="s node-B"
mvn test-compile exec:java -Dexec.classpathScope="test" -Djava.net.preferIPv4Stack=true -Dexec.mainClass="com.github.dexecutor.ignite.Node" -Dexec.args="m node-C"
Refer this example for more detail.
Refer this blog for more detail