Search in sources :

Example 1 with PhysicalPlan

use of org.apache.heron.proto.system.PhysicalPlans.PhysicalPlan in project heron by twitter.

the class PhysicalPlanProvider method ParseResponseToPhysicalPlan.

protected PhysicalPlan ParseResponseToPhysicalPlan(byte[] responseData) {
    // byte to base64 string
    String encodedString = new String(responseData);
    LOG.fine("tmanager returns physical plan in base64 str: " + encodedString);
    // base64 string to proto bytes
    byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
    // construct proto obj from bytes
    PhysicalPlan pp = null;
    try {
        pp = PhysicalPlan.parseFrom(decodedBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new InvalidStateException(topologyName, "Failed to fetch the physical plan");
    }
    return pp;
}
Also used : PhysicalPlan(org.apache.heron.proto.system.PhysicalPlans.PhysicalPlan) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Example 2 with PhysicalPlan

use of org.apache.heron.proto.system.PhysicalPlans.PhysicalPlan in project heron by twitter.

the class ScaleUpResolverTest method createPhysicalPlanProvider.

private PhysicalPlanProvider createPhysicalPlanProvider(TopologyAPI.Topology topology) {
    PhysicalPlan pp = PhysicalPlan.newBuilder().setTopology(topology).build();
    PhysicalPlanProvider physicalPlanProvider = mock(PhysicalPlanProvider.class);
    when(physicalPlanProvider.get()).thenReturn(pp);
    return physicalPlanProvider;
}
Also used : PhysicalPlan(org.apache.heron.proto.system.PhysicalPlans.PhysicalPlan) PhysicalPlanProvider(org.apache.heron.healthmgr.common.PhysicalPlanProvider)

Aggregations

PhysicalPlan (org.apache.heron.proto.system.PhysicalPlans.PhysicalPlan)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 PhysicalPlanProvider (org.apache.heron.healthmgr.common.PhysicalPlanProvider)1