use of com.hazelcast.jet.JetInstance in project beam by apache.
the class TestJetRunner method run.
@Override
public PipelineResult run(Pipeline pipeline) {
Collection<JetInstance> instances = initMemberInstances(factory);
try {
PipelineResult result = delegate.run(pipeline);
if (result instanceof FailedRunningPipelineResults) {
throw ((FailedRunningPipelineResults) result).getCause();
}
result.waitUntilFinish();
return result;
} finally {
killMemberInstances(instances, factory);
}
}
use of com.hazelcast.jet.JetInstance in project hazelcast by hazelcast.
the class TestJob method main.
public static void main(String[] args) {
DAG dag = new DAG();
dag.newVertex("v", StreamNoopProcessor::new);
JetInstance instance = Jet.bootstrappedInstance();
instance.newJob(dag);
}
use of com.hazelcast.jet.JetInstance in project gora by apache.
the class JetTest method testNewJetSource.
@Test
public void testNewJetSource() throws Exception {
DataStore<Long, Pageview> dataStoreIn;
dataStoreIn = DataStoreFactory.getDataStore(Long.class, Pageview.class, utility.getConfiguration());
dataStoreOut = DataStoreFactory.getDataStore(Long.class, ResultPageView.class, utility.getConfiguration());
query = dataStoreIn.newQuery();
query.setStartKey(0L);
query.setEndKey(55L);
JetEngine<Long, Pageview, Long, ResultPageView> jetEngine = new JetEngine<>();
BatchSource<JetInputOutputFormat<Long, Pageview>> fileSource = jetEngine.createDataSource(dataStoreIn, query);
Pipeline p = Pipeline.create();
p.drawFrom(fileSource).filter(item -> item.getValue().getIp().toString().equals("88.240.129.183")).map(e -> {
ResultPageView resultPageView = new ResultPageView();
resultPageView.setIp(e.getValue().getIp());
resultPageView.setTimestamp(e.getValue().getTimestamp());
resultPageView.setUrl(e.getValue().getUrl());
return new JetInputOutputFormat<Long, ResultPageView>(e.getValue().getTimestamp(), resultPageView);
}).drainTo(jetEngine.createDataSink(dataStoreOut));
JetInstance jet = Jet.newJetInstance();
Jet.newJetInstance();
try {
jet.newJob(p).join();
} finally {
Jet.shutdownAll();
}
Query<Long, ResultPageView> query = dataStoreOut.newQuery();
Result<Long, ResultPageView> result = query.execute();
int noOfOutputRecords = 0;
String ip = "";
while (result.next()) {
noOfOutputRecords++;
ip = result.get().getIp().toString();
assertEquals("88.240.129.183", ip);
}
assertEquals(2, noOfOutputRecords);
}
use of com.hazelcast.jet.JetInstance in project hazelcast by hazelcast.
the class HazelcastBootstrapTest method testJet_bootstrappedInstance.
@Test
public void testJet_bootstrappedInstance() {
JetInstance jet = Jet.bootstrappedInstance();
executeWithBootstrappedInstance(jet);
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class StartServer method main.
/**
* Creates a server instance of Hazelcast Jet. If the system property
* {@code print.port} is set, the server writes the port number of the
* Hazelcast instance to a file named by the property.
*/
public static void main(String[] args) throws Exception {
JetInstance jet = Jet.newJetInstance();
printMemberPort(jet.getHazelcastInstance());
}
Aggregations