use of org.apache.samza.config.MapConfig in project samza by apache.
the class ClusterBasedJobCoordinator method main.
/**
* The entry point for the {@link ClusterBasedJobCoordinator}
* @param args args
*/
public static void main(String[] args) {
Config coordinatorSystemConfig = null;
final String coordinatorSystemEnv = System.getenv(ShellCommandConfig.ENV_COORDINATOR_SYSTEM_CONFIG());
try {
//Read and parse the coordinator system config.
log.info("Parsing coordinator system config {}", coordinatorSystemEnv);
coordinatorSystemConfig = new MapConfig(SamzaObjectMapper.getObjectMapper().readValue(coordinatorSystemEnv, Config.class));
} catch (IOException e) {
log.error("Exception while reading coordinator stream config {}", e);
throw new SamzaException(e);
}
ClusterBasedJobCoordinator jc = new ClusterBasedJobCoordinator(coordinatorSystemConfig);
jc.run();
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestExecutionPlanner method testTriggerIntervalWithInvalidWindowMs.
@Test
public void testTriggerIntervalWithInvalidWindowMs() throws Exception {
Map<String, String> map = new HashMap<>(config);
map.put(TaskConfig.WINDOW_MS(), "-1");
map.put(JobConfig.JOB_INTERMEDIATE_STREAM_PARTITIONS(), String.valueOf(DEFAULT_PARTITIONS));
Config cfg = new MapConfig(map);
ExecutionPlanner planner = new ExecutionPlanner(cfg, streamManager);
StreamGraphImpl streamGraph = createStreamGraphWithJoinAndWindow();
ExecutionPlan plan = planner.plan(streamGraph);
List<JobConfig> jobConfigs = plan.getJobConfigs();
assertEquals(jobConfigs.size(), 1);
// GCD of 8, 16, 1600 and 252 is 4
assertEquals(jobConfigs.get(0).get(TaskConfig.WINDOW_MS()), "4");
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestContainerProcessManager method testAppMasterWithFwk.
@Test
public void testAppMasterWithFwk() {
ContainerProcessManager taskManager = new ContainerProcessManager(new MapConfig(config), state, new MetricsRegistryMap(), manager);
taskManager.start();
SamzaResource container2 = new SamzaResource(1, 1024, "", "id0");
assertFalse(taskManager.shouldShutdown());
taskManager.onResourceAllocated(container2);
configVals.put(JobConfig.SAMZA_FWK_PATH(), "/export/content/whatever");
Config config1 = new MapConfig(configVals);
ContainerProcessManager taskManager1 = new ContainerProcessManager(new MapConfig(config), state, new MetricsRegistryMap(), manager);
taskManager1.start();
taskManager1.onResourceAllocated(container2);
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestContainerProcessManager method testTaskManagerShouldStopWhenContainersFinish.
/**
* Test Task Manager should stop when all containers finish
*/
@Test
public void testTaskManagerShouldStopWhenContainersFinish() {
Config conf = getConfig();
ContainerProcessManager taskManager = new ContainerProcessManager(new MapConfig(conf), state, new MetricsRegistryMap(), manager);
taskManager.start();
assertFalse(taskManager.shouldShutdown());
taskManager.onResourceCompleted(new SamzaResourceStatus("123", "diagnostics", SamzaResourceStatus.SUCCESS));
assertTrue(taskManager.shouldShutdown());
}
use of org.apache.samza.config.MapConfig in project samza by apache.
the class TestContainerAllocator method getConfig.
private static Config getConfig() {
Config config = new MapConfig(new HashMap<String, String>() {
{
put("yarn.container.count", "1");
put("systems.test-system.samza.factory", "org.apache.samza.job.yarn.MockSystemFactory");
put("yarn.container.memory.mb", "512");
put("yarn.package.path", "/foo");
put("task.inputs", "test-system.test-stream");
put("systems.test-system.samza.key.serde", "org.apache.samza.serializers.JsonSerde");
put("systems.test-system.samza.msg.serde", "org.apache.samza.serializers.JsonSerde");
put("yarn.container.retry.count", "1");
put("yarn.container.retry.window.ms", "1999999999");
put("yarn.allocator.sleep.ms", "10");
}
});
Map<String, String> map = new HashMap<>();
map.putAll(config);
return new MapConfig(map);
}
Aggregations