Search in sources :

Example 11 with NoOutputSourceP

use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.

the class JobRepositoryTest method test_getJobRecordFromClient.

@Test
public void test_getJobRecordFromClient() {
    HazelcastInstance client = createHazelcastClient();
    Pipeline p = Pipeline.create();
    p.readFrom(Sources.streamFromProcessor("source", ProcessorMetaSupplier.of(() -> new NoOutputSourceP()))).withoutTimestamps().writeTo(Sinks.logger());
    Job job = instance.getJet().newJob(p, new JobConfig().setProcessingGuarantee(ProcessingGuarantee.EXACTLY_ONCE).setSnapshotIntervalMillis(100));
    JobRepository jobRepository = new JobRepository(client);
    assertTrueEventually(() -> assertNotNull(jobRepository.getJobRecord(job.getId())));
    client.shutdown();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) NoOutputSourceP(com.hazelcast.jet.core.TestProcessors.NoOutputSourceP) Job(com.hazelcast.jet.Job) JobConfig(com.hazelcast.jet.config.JobConfig) Pipeline(com.hazelcast.jet.pipeline.Pipeline) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 12 with NoOutputSourceP

use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.

the class TopologyChangeTest method when_nonCoordinatorLeavesDuringExecution_then_clientStillGetsJobResult.

@Test
public void when_nonCoordinatorLeavesDuringExecution_then_clientStillGetsJobResult() throws Throwable {
    // Given
    HazelcastInstance client = createHazelcastClient();
    DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, nodeCount)));
    // When
    Job job = client.getJet().newJob(dag);
    NoOutputSourceP.executionStarted.await();
    instances[2].getLifecycleService().terminate();
    NoOutputSourceP.proceedLatch.countDown();
    job.join();
}
Also used : MockPS(com.hazelcast.jet.core.TestProcessors.MockPS) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NoOutputSourceP(com.hazelcast.jet.core.TestProcessors.NoOutputSourceP) Job(com.hazelcast.jet.Job) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 13 with NoOutputSourceP

use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.

the class WriteBufferedPTest method when_writeBufferedJobFailed_then_bufferDisposed.

@Test
public void when_writeBufferedJobFailed_then_bufferDisposed() throws Exception {
    HazelcastInstance instance = createHazelcastInstance();
    DAG dag = new DAG();
    Vertex source = dag.newVertex("source", () -> new NoOutputSourceP());
    Vertex sink = dag.newVertex("sink", getLoggingBufferedWriter()).localParallelism(1);
    dag.edge(Edge.between(source, sink));
    Job job = instance.getJet().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);
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NoOutputSourceP(com.hazelcast.jet.core.TestProcessors.NoOutputSourceP) DAG(com.hazelcast.jet.core.DAG) Job(com.hazelcast.jet.Job) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 14 with NoOutputSourceP

use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.

the class JobMetrics_NonSharedClusterTest method when_metricsCollectionOff_then_emptyMetrics.

@Test
public void when_metricsCollectionOff_then_emptyMetrics() {
    Config config = smallInstanceConfig();
    config.getMetricsConfig().setEnabled(false);
    HazelcastInstance inst = createHazelcastInstance(config);
    DAG dag = new DAG();
    dag.newVertex("v1", (SupplierEx<Processor>) NoOutputSourceP::new).localParallelism(1);
    Job job = inst.getJet().newJob(dag, JOB_CONFIG_WITH_METRICS);
    assertTrue(job.getMetrics().metrics().isEmpty());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) NoOutputSourceP(com.hazelcast.jet.core.TestProcessors.NoOutputSourceP) SupplierEx(com.hazelcast.function.SupplierEx) DAG(com.hazelcast.jet.core.DAG) Job(com.hazelcast.jet.Job) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 15 with NoOutputSourceP

use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.

the class TerminalSnapshotSynchronizationTest method setup.

private Job setup(boolean snapshotting) {
    HazelcastInstance[] instances = createHazelcastInstances(NODE_COUNT);
    DAG dag = new DAG();
    dag.newVertex("generator", () -> new NoOutputSourceP()).localParallelism(1);
    JobConfig config = new JobConfig().setProcessingGuarantee(snapshotting ? EXACTLY_ONCE : NONE).setSnapshotIntervalMillis(DAYS.toMillis(1));
    Job job = instances[0].getJet().newJob(dag, config);
    assertJobStatusEventually(job, RUNNING);
    return job;
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) NoOutputSourceP(com.hazelcast.jet.core.TestProcessors.NoOutputSourceP) Job(com.hazelcast.jet.Job) JobConfig(com.hazelcast.jet.config.JobConfig)

Aggregations

NoOutputSourceP (com.hazelcast.jet.core.TestProcessors.NoOutputSourceP)68 Job (com.hazelcast.jet.Job)64 Test (org.junit.Test)54 MockPS (com.hazelcast.jet.core.TestProcessors.MockPS)52 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)43 QuickTest (com.hazelcast.test.annotation.QuickTest)33 JobConfig (com.hazelcast.jet.config.JobConfig)31 HazelcastInstance (com.hazelcast.core.HazelcastInstance)22 NightlyTest (com.hazelcast.test.annotation.NightlyTest)11 CancellationException (java.util.concurrent.CancellationException)11 CountDownLatch (java.util.concurrent.CountDownLatch)11 SlowTest (com.hazelcast.test.annotation.SlowTest)10 Config (com.hazelcast.config.Config)9 JetServiceBackend (com.hazelcast.jet.impl.JetServiceBackend)9 JobRepository (com.hazelcast.jet.impl.JobRepository)9 Future (java.util.concurrent.Future)8 ExpectedException (org.junit.rules.ExpectedException)8 JobExecutionRecord (com.hazelcast.jet.impl.JobExecutionRecord)7 MasterContext (com.hazelcast.jet.impl.MasterContext)7 ClusterService (com.hazelcast.internal.cluster.ClusterService)6