Search in sources :

Example 26 with JobRepository

use of com.hazelcast.jet.impl.JobRepository in project hazelcast by hazelcast.

the class WriteFilePTest method stressTest_snapshots_noRestarts.

@Test
public void stressTest_snapshots_noRestarts() throws Exception {
    DAG dag = new DAG();
    int numItems = 5;
    Vertex source = dag.newVertex("source", () -> new SlowSourceP(semaphore, numItems)).localParallelism(1);
    Vertex sink = dag.newVertex("sink", writeFileP(directory.toString(), StandardCharsets.UTF_8, null, DISABLE_ROLLING, true, Object::toString)).localParallelism(1);
    dag.edge(between(source, sink));
    JobConfig config = new JobConfig().setProcessingGuarantee(EXACTLY_ONCE).setSnapshotIntervalMillis(500);
    Job job = instance().getJet().newJob(dag, config);
    assertJobStatusEventually(job, RUNNING);
    JobRepository jr = new JobRepository(instance());
    waitForFirstSnapshot(jr, job.getId(), 10, true);
    for (int i = 0; i < numItems; i++) {
        waitForNextSnapshot(jr, job.getId(), 10, true);
        semaphore.release();
    }
    job.join();
    checkFileContents(0, numItems, false, false, true);
}
Also used : Vertex(com.hazelcast.jet.core.Vertex) DAG(com.hazelcast.jet.core.DAG) Job(com.hazelcast.jet.Job) JobRepository(com.hazelcast.jet.impl.JobRepository) JobConfig(com.hazelcast.jet.config.JobConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

Job (com.hazelcast.jet.Job)26 JobRepository (com.hazelcast.jet.impl.JobRepository)26 JobConfig (com.hazelcast.jet.config.JobConfig)22 Test (org.junit.Test)22 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)14 QuickTest (com.hazelcast.test.annotation.QuickTest)9 HazelcastInstance (com.hazelcast.core.HazelcastInstance)8 EXACTLY_ONCE (com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE)7 JobExecutionRecord (com.hazelcast.jet.impl.JobExecutionRecord)7 Assert.assertEquals (org.junit.Assert.assertEquals)7 Assert.assertTrue (org.junit.Assert.assertTrue)7 MockPS (com.hazelcast.jet.core.TestProcessors.MockPS)5 NoOutputSourceP (com.hazelcast.jet.core.TestProcessors.NoOutputSourceP)5 SlowTest (com.hazelcast.test.annotation.SlowTest)5 Map (java.util.Map)5 Collectors (java.util.stream.Collectors)5 Category (org.junit.experimental.categories.Category)5 Config (com.hazelcast.config.Config)4 Edge.between (com.hazelcast.jet.core.Edge.between)4 RUNNING (com.hazelcast.jet.core.JobStatus.RUNNING)4