private MetadataProperties mockMetadataProperties() { SortedMap<Integer, ClusterPartition> clusterPartitions = Collections.synchronizedSortedMap(new TreeMap<>()); Map<String, ClusterPartition[]> nodePartitionsMap = new ConcurrentHashMap<>(); nodePartitionsMap.put(METADATA_NODE, new ClusterPartition[] { new ClusterPartition(0, METADATA_NODE, 0) }); MetadataProperties metadataProperties = Mockito.mock(MetadataProperties.class); Mockito.when(metadataProperties.getMetadataNodeName()).thenReturn(METADATA_NODE); Mockito.when(metadataProperties.getClusterPartitions()).thenReturn(clusterPartitions); Mockito.when(metadataProperties.getNodePartitions()).thenReturn(nodePartitionsMap); return metadataProperties; }
@Override public void setCcAppCtx(ICcApplicationContext appCtx) { this.appCtx = appCtx; node2PartitionsMap = appCtx.getMetadataProperties().getNodePartitions(); clusterPartitions = appCtx.getMetadataProperties().getClusterPartitions(); currentMetadataNode = appCtx.getMetadataProperties().getMetadataNodeName(); metadataPartition = node2PartitionsMap.get(currentMetadataNode)[0]; lifecycleCoordinator = appCtx.getNcLifecycleCoordinator(); lifecycleCoordinator.bindTo(this); }
IApplicationContext appCtx = (IApplicationContext) ctx.getJobletContext().getServiceContext().getApplicationContext(); ClusterPartition nodePartition = appCtx.getMetadataProperties().getNodePartitions().get(nodeId)[0]; parser = new ADMDataParser(outputType, true); tb = new ArrayTupleBuilder(1);
datasetMemoryManager, indexCheckpointManagerProvider, ioManager.getIODevices().size()); final String nodeId = getServiceContext().getNodeId(); final ClusterPartition[] nodePartitions = metadataProperties.getNodePartitions().get(nodeId); final Set<Integer> nodePartitionsIds = Arrays.stream(nodePartitions).map(ClusterPartition::getPartitionId).collect(Collectors.toSet());
ccAppCtx.getMetadataProperties().getClusterPartitions().put(2, new ClusterPartition(2, NC3, 0)); for (ClusterPartition cp : ccAppCtx.getMetadataProperties().getClusterPartitions().values()) { ccAppCtx.getMetadataProperties().getNodePartitions().put(cp.getNodeId(), new ClusterPartition[] { cp });