Examples of Partition


Examples of org.apache.hadoop.zebra.types.Partition

    if (schema == null)
      throw new ParseException("Schema has not been set");

    // for sanity check purpose only
    new Partition(schema, storehint, null);

    conf.set(OUTPUT_STORAGEHINT, storehint);
  }
View Full Code Here

Examples of org.apache.hadoop.zebra.types.Partition

    } else {
      storageHintStr = zStorageHint.toString();
    }
   
    try {
      new Partition(schemaStr, storageHintStr, null);
    } catch (ParseException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    } catch (IOException e) {
      throw new ParseException("[" + zStorageHint + "] " + " is not a valid storage hint string: " + e.getMessage()  );
    }
View Full Code Here

Examples of org.apache.helix.api.Partition

  private static ResourceConfig getResource(StateModelDefinition stateModelDef) {
    // identify the resource
    ResourceId resourceId = ResourceId.from("exampleResource");

    // create a partition
    Partition partition1 = new Partition(PartitionId.from(resourceId, "1"));

    // create a second partition
    Partition partition2 = new Partition(PartitionId.from(resourceId, "2"));

    // specify the rebalancer configuration
    // this resource will be rebalanced in FULL_AUTO mode, so use the FullAutoRebalancerContext
    // builder
    FullAutoRebalancerContext.Builder rebalanceContextBuilder =
View Full Code Here

Examples of org.apache.helix.model.Partition

          for (String partitionName : partErrStates.keySet())
          {
            String instanceName = partErrStates.get(partitionName);
            Map<String, String> partStateMap =
                bestPossOutput.getInstanceStateMap(resourceName,
                                                   new Partition(partitionName));
            partStateMap.put(instanceName, "ERROR");
          }
        }
      }

     
      for (String resourceName : idealStates.keySet())
      {
        ExternalView extView = extViews.get(resourceName);
        if (extView == null)
        {
          LOG.info("externalView for " + resourceName + " is not available");
          return false;
        }

        // step 0: remove empty map and DROPPED state from best possible state
        Map<Partition, Map<String, String>> bpStateMap =
            bestPossOutput.getResourceMap(resourceName);
        Iterator<Entry<Partition, Map<String, String>>> iter =
            bpStateMap.entrySet().iterator();
        while (iter.hasNext())
        {
          Map.Entry<Partition, Map<String, String>> entry = iter.next();
          Map<String, String> instanceStateMap = entry.getValue();
          if (instanceStateMap.isEmpty())
          {
            iter.remove();
          } else
          {
            // remove instances with DROPPED state
            Iterator<Map.Entry<String, String>> insIter = instanceStateMap.entrySet().iterator();
            while (insIter.hasNext())
            {
              Map.Entry<String, String> insEntry = insIter.next();
              String state = insEntry.getValue();
              if (state.equalsIgnoreCase("DROPPED"))
              {
                insIter.remove();
              }  
            }
          }
        }

        // System.err.println("resource: " + resourceName + ", bpStateMap: " + bpStateMap);

        // step 1: externalView and bestPossibleState has equal size
        int extViewSize = extView.getRecord().getMapFields().size();
        int bestPossStateSize = bestPossOutput.getResourceMap(resourceName).size();
        if (extViewSize != bestPossStateSize)
        {
          LOG.info("exterView size (" + extViewSize
              + ") is different from bestPossState size (" + bestPossStateSize
              + ") for resource: " + resourceName);
          // System.out.println("extView: " + extView.getRecord().getMapFields());
          // System.out.println("bestPossState: " +
          // bestPossOutput.getResourceMap(resourceName));
          return false;
        }

        // step 2: every entry in external view is contained in best possible state
        for (String partition : extView.getRecord().getMapFields().keySet())
        {
          Map<String, String> evInstanceStateMap =
              extView.getRecord().getMapField(partition);
          Map<String, String> bpInstanceStateMap =
              bestPossOutput.getInstanceStateMap(resourceName, new Partition(partition));

          boolean result =
              ClusterStateVerifier.<String, String> compareMap(evInstanceStateMap,
                                                               bpInstanceStateMap);
          if (result == false)
View Full Code Here

Examples of org.apache.ivory.entity.v0.feed.Partition

        Assert.assertTrue(UpdateHelper.shouldUpdate(oldFeed, newFeed, process));

        newFeed.setFrequency(oldFeed.getFrequency());
        Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process));

        Partition partition = new Partition();
        partition.setName("1");
        newFeed.getPartitions().getPartitions().add(partition);
        Assert.assertFalse(UpdateHelper.shouldUpdate(oldFeed, newFeed, process));

        Property property = new Property();
        property.setName("1");
View Full Code Here

Examples of org.apache.samza.Partition

    ObjectMapper mapper = SamzaObjectMapper.getObjectMapper();
    Map<String, String> configMap = new HashMap<String, String>();
    configMap.put("a", "b");
    Config config = new MapConfig(configMap);
    Set<SystemStreamPartition> inputSystemStreamPartitions = new HashSet<SystemStreamPartition>();
    inputSystemStreamPartitions.add(new SystemStreamPartition("foo", "bar", new Partition(1)));
    TaskName taskName = new TaskName("test");
    TaskModel taskModel = new TaskModel(taskName, inputSystemStreamPartitions, new Partition(2));
    Map<TaskName, TaskModel> tasks = new HashMap<TaskName, TaskModel>();
    tasks.put(taskName, taskModel);
    ContainerModel containerModel = new ContainerModel(1, tasks);
    Map<Integer, ContainerModel> containerMap = new HashMap<Integer, ContainerModel>();
    containerMap.put(Integer.valueOf(1), containerModel);
View Full Code Here

Examples of org.apache.samza.Partition

    SystemStreamMetadata metadata1 = metadata.get("a");
    SystemStreamMetadata metadata2 = metadata.get("b");

    assertEquals(1, metadata1.getSystemStreamPartitionMetadata().size());
    assertEquals(1, metadata2.getSystemStreamPartitionMetadata().size());
    assertNull(metadata.get(new SystemStreamPartition("test-system", "c", new Partition(0))));
  }
View Full Code Here

Examples of org.apache.samza.Partition

  public static class PartitionDeserializer extends JsonDeserializer<Partition> {
    @Override
    public Partition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      return new Partition(node.getIntValue());
    }
View Full Code Here

Examples of org.apache.samza.Partition

    public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      String system = node.get("system").getTextValue();
      String stream = node.get("stream").getTextValue();
      Partition partition = new Partition(node.get("partition").getIntValue());
      return new SystemStreamPartition(system, stream, partition);
    }
View Full Code Here

Examples of org.apache.samza.Partition

  public MockSystemAdmin(int partitionCount) {
    this.systemStreamPartitionMetadata = new HashMap<Partition, SystemStreamPartitionMetadata>();

    for (int i = 0; i < partitionCount; ++i) {
      systemStreamPartitionMetadata.put(new Partition(i), new SystemStreamPartitionMetadata(null, null, null));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.