Search in sources :

Example 26 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast by hazelcast.

the class ConfigXmlGenerator method jetConfig.

private static void jetConfig(XmlGenerator gen, Config config) {
    JetConfig jetConfig = config.getJetConfig();
    EdgeConfig edgeConfig = jetConfig.getDefaultEdgeConfig();
    gen.open("jet", "enabled", jetConfig.isEnabled(), "resource-upload-enabled", jetConfig.isResourceUploadEnabled()).node("cooperative-thread-count", jetConfig.getCooperativeThreadCount()).node("flow-control-period", jetConfig.getFlowControlPeriodMs()).node("backup-count", jetConfig.getBackupCount()).node("scale-up-delay-millis", jetConfig.getScaleUpDelayMillis()).node("lossless-restart-enabled", jetConfig.isLosslessRestartEnabled()).node("max-processor-accumulated-records", jetConfig.getMaxProcessorAccumulatedRecords()).open("edge-defaults").node("queue-size", edgeConfig.getQueueSize()).node("packet-size-limit", edgeConfig.getPacketSizeLimit()).node("receive-window-multiplier", edgeConfig.getReceiveWindowMultiplier()).close().close();
}
Also used : EdgeConfig(com.hazelcast.jet.config.EdgeConfig) JetConfig(com.hazelcast.jet.config.JetConfig)

Example 27 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast by hazelcast.

the class TestInClusterSupport method prepareConfig.

protected static Config prepareConfig() {
    parallelism = Runtime.getRuntime().availableProcessors() / MEMBER_COUNT / 2;
    Config config = smallInstanceConfig();
    JetConfig jetConfig = config.getJetConfig().setResourceUploadEnabled(true);
    jetConfig.setCooperativeThreadCount(max(2, parallelism));
    config.getMetricsConfig().setCollectionFrequencySeconds(1);
    // Set partition count to match the parallelism of IMap sources.
    // Their preferred local parallelism is 2, therefore partition count
    // should be 2 * MEMBER_COUNT.
    config.setProperty(ClusterProperty.PARTITION_COUNT.getName(), "" + 2 * MEMBER_COUNT);
    config.addCacheConfig(new CacheSimpleConfig().setName("*"));
    config.getMapConfig(JOURNALED_MAP_PREFIX + '*').getEventJournalConfig().setEnabled(true);
    config.getCacheConfig(JOURNALED_CACHE_PREFIX + '*').getEventJournalConfig().setEnabled(true);
    return config;
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) JobConfig(com.hazelcast.jet.config.JobConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) JetConfig(com.hazelcast.jet.config.JetConfig)

Example 28 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast by hazelcast.

the class JobClassLoaderService method getOrCreateClassLoader.

/**
 * Get or create a Job classloader for a job with given config.
 * <p>
 * It also creates processor classloaders if any are configured.
 *
 * @param config job config to use to create the classloader
 * @param jobId  id of the job
 * @param phase  phase for which the classloader is needed - coordinator/member
 * @return job classloader
 */
public ClassLoader getOrCreateClassLoader(JobConfig config, long jobId, JobPhase phase) {
    JetConfig jetConfig = nodeEngine.getConfig().getJetConfig();
    JobClassLoaders jobClassLoaders = classLoaders.compute(jobId, (k, current) -> {
        JobClassLoaders result = current;
        if (current == null) {
            result = createJobClassLoaders(config, jobId, jetConfig);
        }
        result.recordPhase(phase);
        return result;
    });
    jobClassLoaders.recordPhase(phase);
    return jobClassLoaders.jobClassLoader();
}
Also used : JetConfig(com.hazelcast.jet.config.JetConfig)

Example 29 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast by hazelcast.

the class TestFullApplicationContext method testJetConfig.

@Test
public void testJetConfig() {
    JetConfig jetConfig = config.getJetConfig();
    assertTrue(jetConfig.isEnabled());
    assertTrue(jetConfig.isResourceUploadEnabled());
    assertEquals(4, jetConfig.getCooperativeThreadCount());
    assertEquals(2, jetConfig.getBackupCount());
    assertEquals(200, jetConfig.getFlowControlPeriodMs());
    assertEquals(20000, jetConfig.getScaleUpDelayMillis());
    assertEquals(1000000, jetConfig.getMaxProcessorAccumulatedRecords());
    assertFalse(jetConfig.isLosslessRestartEnabled());
    EdgeConfig edgeConfig = jetConfig.getDefaultEdgeConfig();
    assertEquals(2048, edgeConfig.getQueueSize());
    assertEquals(15000, edgeConfig.getPacketSizeLimit());
    assertEquals(4, edgeConfig.getReceiveWindowMultiplier());
}
Also used : EdgeConfig(com.hazelcast.jet.config.EdgeConfig) JetConfig(com.hazelcast.jet.config.JetConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 30 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleJet.

private void handleJet(Node node) {
    JetConfig jetConfig = config.getJetConfig();
    NamedNodeMap attributes = node.getAttributes();
    for (int a = 0; a < attributes.getLength(); a++) {
        Node attribute = attributes.item(a);
        if (matches("enabled", attribute.getNodeName())) {
            boolean enabled = getBooleanValue(getAttribute(node, "enabled"));
            jetConfig.setEnabled(enabled);
        } else if (matches("resource-upload-enabled", attribute.getNodeName())) {
            boolean resourceUploadEnabled = getBooleanValue(getAttribute(node, "resource-upload-enabled"));
            jetConfig.setResourceUploadEnabled(resourceUploadEnabled);
        }
    }
    // <instance> tag will be ignored.
    for (Node child : childElements(node)) {
        String nodeName = cleanNodeName(child);
        if (matches("cooperative-thread-count", nodeName)) {
            jetConfig.setCooperativeThreadCount(getIntegerValue("cooperative-thread-count", getTextContent(child)));
        } else if (matches("flow-control-period", nodeName)) {
            jetConfig.setFlowControlPeriodMs(getIntegerValue("flow-control-period", getTextContent(child)));
        } else if (matches("backup-count", nodeName)) {
            jetConfig.setBackupCount(getIntegerValue("backup-count", getTextContent(child)));
        } else if (matches("scale-up-delay-millis", nodeName)) {
            jetConfig.setScaleUpDelayMillis(getLongValue("scale-up-delay-millis", getTextContent(child)));
        } else if (matches("lossless-restart-enabled", nodeName)) {
            jetConfig.setLosslessRestartEnabled(getBooleanValue(getTextContent(child)));
        } else if (matches("max-processor-accumulated-records", nodeName)) {
            jetConfig.setMaxProcessorAccumulatedRecords(getLongValue("max-processor-accumulated-records", getTextContent(child)));
        } else if (matches("edge-defaults", nodeName)) {
            handleEdgeDefaults(jetConfig, child);
        } else if (matches("instance", nodeName)) {
            if (jetConfigContainsInstanceConfigFields(node)) {
                LOGGER.warning("<instance> tag will be ignored " + "since <jet> tag already contains the instance fields.");
            } else {
                LOGGER.warning("<instance> tag is deprecated, use <jet> tag directly for configuration.");
                handleInstance(jetConfig, child);
            }
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node) JetConfig(com.hazelcast.jet.config.JetConfig)

Aggregations

JetConfig (com.hazelcast.jet.config.JetConfig)56 Before (org.junit.Before)21 Test (org.junit.Test)15 JetInstance (com.hazelcast.jet.JetInstance)14 Config (com.hazelcast.config.Config)10 Properties (java.util.Properties)9 EventJournalConfig (com.hazelcast.config.EventJournalConfig)8 CountDownLatch (java.util.concurrent.CountDownLatch)7 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)4 EdgeConfig (com.hazelcast.jet.config.EdgeConfig)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 MapConfig (com.hazelcast.config.MapConfig)3 JobConfig (com.hazelcast.jet.config.JobConfig)3 MockPS (com.hazelcast.jet.core.TestProcessors.MockPS)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 InputStream (java.io.InputStream)3 JoinConfig (com.hazelcast.config.JoinConfig)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 JetTestInstanceFactory (com.hazelcast.jet.JetTestInstanceFactory)2 Job (com.hazelcast.jet.Job)2