本文整理汇总了Java中com.hazelcast.jet.JetInstance.newJob方法的典型用法代码示例。如果您正苦于以下问题:Java JetInstance.newJob方法的具体用法?Java JetInstance.newJob怎么用?Java JetInstance.newJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hazelcast.jet.JetInstance
的用法示例。
在下文中一共展示了JetInstance.newJob方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: when_writeBufferedJobFailed_then_bufferDisposed
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_writeBufferedJobFailed_then_bufferDisposed() throws Exception {
JetInstance instance = createJetMember();
try {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", StuckForeverSourceP::new);
Vertex sink = dag.newVertex("sink", getLoggingBufferedWriter()).localParallelism(1);
dag.edge(Edge.between(source, sink));
Job job = instance.newJob(dag);
// wait for the job to initialize
Thread.sleep(5000);
job.cancel();
assertTrueEventually(() -> assertTrue("No \"dispose\", only: " + events, events.contains("dispose")), 60);
System.out.println(events);
} finally {
instance.shutdown();
}
}
示例2: when_jobCancelledOnSingleNode_then_terminatedEventually
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelledOnSingleNode_then_terminatedEventually() {
// Given
JetInstance instance = newInstance();
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = instance.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertExecutionTerminated();
expectedException.expect(CancellationException.class);
job.join();
}
示例3: when_jobCancelledOnMultipleNodes_then_terminatedEventually
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelledOnMultipleNodes_then_terminatedEventually() {
// Given
newInstance();
JetInstance instance = newInstance();
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = instance.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertExecutionTerminated();
expectedException.expect(CancellationException.class);
job.join();
}
示例4: when_jobCancelled_then_jobStatusIsSetEventually
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelled_then_jobStatusIsSetEventually() {
// Given
JetInstance instance = newInstance();
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = instance.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertTrueEventually(() -> assertEquals(JobStatus.COMPLETED, job.getStatus()), 3);
}
示例5: when_jobCancelledFromClient_then_terminatedEventually
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelledFromClient_then_terminatedEventually() {
// Given
newInstance();
newInstance();
JetInstance client = factory.newClient();
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = client.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertExecutionTerminated();
expectedException.expect(CancellationException.class);
job.join();
}
示例6: when_jobCancelledFromClient_then_jobStatusIsSetEventually
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelledFromClient_then_jobStatusIsSetEventually() {
// Given
newInstance();
newInstance();
JetInstance client = factory.newClient();
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = client.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertTrueEventually(() -> assertEquals(JobStatus.COMPLETED, job.getStatus()), 3);
}
示例7: when_jobCancelled_then_trackedJobsGetNotified
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelled_then_trackedJobsGetNotified() {
// Given
JetInstance instance1 = newInstance();
JetInstance instance2 = newInstance();
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = instance1.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertExecutionTerminated();
expectedException.expect(CancellationException.class);
Job tracked = instance2.getJobs().iterator().next();
tracked.join();
}
示例8: when_jobCancelled_then_jobStatusIsSetDuringCancellation
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCancelled_then_jobStatusIsSetDuringCancellation() {
// Given
JetInstance instance1 = newInstance();
JetInstance instance2 = newInstance();
dropOperationsBetween(instance1.getHazelcastInstance(), instance2.getHazelcastInstance(),
JetInitDataSerializerHook.FACTORY_ID, singletonList(JetInitDataSerializerHook.COMPLETE_EXECUTION_OP));
DAG dag = new DAG();
dag.newVertex("slow", StuckSource::new);
Job job = instance1.newJob(dag);
assertExecutionStarted();
// When
job.cancel();
// Then
assertTrueEventually(() -> assertEquals(JobStatus.COMPLETING, job.getStatus()), 3);
resetPacketFiltersFrom(instance1.getHazelcastInstance());
assertTrueEventually(() -> assertEquals(JobStatus.COMPLETED, job.getStatus()), 3);
}
示例9: when_jobFailsOnOnNonInitiatorNode_then_cancelledOnInitiatorNode
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobFailsOnOnNonInitiatorNode_then_cancelledOnInitiatorNode() throws Throwable {
// Given
JetInstance instance = newInstance();
JetInstance other = newInstance();
RuntimeException fault = new RuntimeException("fault");
DAG dag = new DAG();
dag.newVertex("faulty", new SingleNodeFaultSupplier(getAddress(other.getHazelcastInstance()), fault))
.localParallelism(4);
Job job = instance.newJob(dag);
assertExecutionStarted();
// Then
FaultyProcessor.failNow = true;
assertExecutionTerminated();
expectedException.expect(fault.getClass());
expectedException.expectMessage(fault.getMessage());
try {
job.join();
} catch (Exception e) {
throw peel(e);
}
}
示例10: when_jobFailsOnOnInitiatorNode_then_cancelledOnOtherNodes
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobFailsOnOnInitiatorNode_then_cancelledOnOtherNodes() throws Throwable {
// Given
JetInstance instance = newInstance();
newInstance();
RuntimeException fault = new RuntimeException("fault");
DAG dag = new DAG();
SingleNodeFaultSupplier supplier = new SingleNodeFaultSupplier(getAddress(instance.getHazelcastInstance()), fault);
dag.newVertex("faulty", supplier).localParallelism(4);
Job job = instance.newJob(dag);
assertExecutionStarted();
// Then
FaultyProcessor.failNow = true;
assertExecutionTerminated();
expectedException.expect(fault.getClass());
expectedException.expectMessage(fault.getMessage());
try {
job.join();
} catch (Exception e) {
throw peel(e);
}
}
示例11: when_shutdown_then_jobFuturesCanceled
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_shutdown_then_jobFuturesCanceled() throws Exception {
JetInstance jet = newInstance();
DAG dag = new DAG();
dag.newVertex("blocking", new CloseableProcessorSupplier(BlockingProcessor::new)).localParallelism(1);
jet.newJob(dag);
assertTrueEventually(() -> assertTrue(BlockingProcessor.hasStarted), 3);
jet.shutdown();
assertBlockingProcessorEventuallyNotRunning();
}
示例12: when_jobCanceled_then_jobFutureCanceled
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
@Test
public void when_jobCanceled_then_jobFutureCanceled() {
JetInstance jet = newInstance();
DAG dag = new DAG();
dag.newVertex("blocking", new CloseableProcessorSupplier(BlockingProcessor::new)).localParallelism(1);
Job job = jet.newJob(dag);
assertTrueEventually(() -> assertTrue(BlockingProcessor.hasStarted), 3);
job.cancel();
assertBlockingProcessorEventuallyNotRunning();
}
示例13: testJobStatusDuringStart
import com.hazelcast.jet.JetInstance; //导入方法依赖的package包/类
private void testJobStatusDuringStart(JetInstance submitter) {
PSThatWaitsOnInit.initLatch = new CountDownLatch(1);
DAG dag = new DAG().vertex(new Vertex("test", new PSThatWaitsOnInit(Identity::new)));
// When
Job job = submitter.newJob(dag);
JobStatus status = job.getStatus();
assertTrue(status == NOT_STARTED || status == STARTING);
PSThatWaitsOnInit.initLatch.countDown();
// Then
assertCompletedEventually(job);
}