Examples of LogicalLocation


Examples of org.apache.pig.penny.LogicalLocation

    SimpleCoordinator sc;

    public void startup() throws Exception {
        sc = new SimpleCoordinator();
        ch = new CoordinatorHarness(sc);
        mah1 = new MonitorAgentHarness(new SimpleMonitorAgent(), new LogicalLocation("L1"), new InetSocketAddress("127.0.0.1", CoordinatorHarness.MASTER_LISTEN_PORT),
                logicalIds, empty, l2, l3, null, null);
        mah1.initialize();
        mah2 = new MonitorAgentHarness(new SimpleMonitorAgent(), new LogicalLocation("L2"), new InetSocketAddress("127.0.0.1", CoordinatorHarness.MASTER_LISTEN_PORT),
                logicalIds, l1, empty, l3, null, null);
        mah2.initialize();
        mah3 = new MonitorAgentHarness(new SimpleMonitorAgent(), new LogicalLocation("L3"), new InetSocketAddress("127.0.0.1", CoordinatorHarness.MASTER_LISTEN_PORT),
                logicalIds, empty, empty, l1l2, null, null);
        mah3.initialize();
        Assert.assertEquals(3, ch.getMessagingServer().getPlMap().size());
    }
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

        startup();
        Tuple tuple1 = TupleFactory.getInstance().newTuple();
        tuple1.append(1);
        Tuple tuple2 = TupleFactory.getInstance().newTuple();
        tuple2.append(2);
        LogicalLocation ll2 = new LogicalLocation("L2");
        final SimpleMonitorAgent sma1 = (SimpleMonitorAgent)mah1.getMonitorAgent();
        sma1.communicator().sendToAgents(ll2, tuple1);
        sma1.communicator().sendToAgents(ll2, tuple2);
        int count = 10;
        Thread.sleep(10);
        while(((SimpleMonitorAgent)mah2.getMonitorAgent()).lastTuples.size() != 2 && count > 0) {
            Thread.sleep(400);
            count--;
        }
        List<Tuple> lastTuples = ((SimpleMonitorAgent)mah2.getMonitorAgent()).lastTuples;
        Assert.assertEquals(2, lastTuples.size());
        Assert.assertEquals(tuple1, lastTuples.remove(0));
        Assert.assertEquals(tuple2, lastTuples.remove(0));
        // now startup a new agent to see if it gets the queued up tuples
        MonitorAgentHarness mah4 = new MonitorAgentHarness(new SimpleMonitorAgent(), new LogicalLocation("L2"), new InetSocketAddress("127.0.0.1", CoordinatorHarness.MASTER_LISTEN_PORT),
                logicalIds, l1, empty, l3, null, null);
        mah4.initialize();
        Thread.sleep(10);
        while(((SimpleMonitorAgent)mah4.getMonitorAgent()).lastTuples.size() != 2 && count > 0) {
            Thread.sleep(400);
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

                    throw new NoSuchLocationException("Line "
                            + logicalLocation.logId()
                            + " has no downstream neighbor.");
                for (String neighbor : withinTaskDownstreamNeighbors) {
                    sendWithinTaskMessage(neighbor, new Message(location,
                            new LogicalLocation(neighbor), message));
                }
                for (String neighbor : crossTaskDownstreamNeighbors) {
                    senderReceiver
                            .sendAsync(new Message(location,
                                    new LogicalLocation(neighbor), message));
                }
            }

            @Override
            public void sendUpstream(Tuple message)
                    throws NoSuchLocationException {
                if (withinTaskUpstreamNeighbors.isEmpty())
                    throw new NoSuchLocationException("Line "
                            + logicalLocation.logId()
                            + " has no within-task upstream neighbor.");
                for (String neighbor : withinTaskUpstreamNeighbors) {
                    sendWithinTaskMessage(neighbor, new Message(location,
                            new LogicalLocation(neighbor), message));
                }
            }

            @Override
            public void sendToAgents(LogicalLocation destination, Tuple tuple)
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

            body.append(keys);
            for (String tag : tags) {
                body.append(tag);
            }
            senderReceiver.sendAsync(new Message(Message.Type.TAINT, location,
                    new LogicalLocation(neighbor), body));
        }
    }
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

            body.append("within");
            for (String tag : tags) {
                body.append(tag);
            }
            for (String neighbor : withinTaskDownstreamNeighbors) {
                sendWithinTaskMessage(neighbor, new Message(Message.Type.TAINT, location, new LogicalLocation(neighbor), body));
            }
            withinTaskDownstreamTaint = tags;
        }
    }
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

       
        MonitorAgent monitorAgent = (MonitorAgent) Class.forName(args.monitorClassName).newInstance();
        monitorAgent.init(args.monitorClassArgs);
        harness = new MonitorAgentHarness(
                monitorAgent,
                new LogicalLocation(args.alias),
                new InetSocketAddress(args.masterHost, args.masterPort),
                args.logicalIds,
                args.withinTaskUpstreamNeighbors,
                args.withinTaskDownstreamNeighbors,
                args.crossTaskDownstreamNeighbors,
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

   
    public static Message fromTuple(Tuple t) throws IOException {
        Tuple body = (Tuple) t.get(0);
        Type type = stringToType((String) t.get(1));
        int ack = (Integer)t.get(2);
        Location source = (t.get(4) instanceof Integer)? new PhysicalLocation((String) t.get(3), (Integer) t.get(4)) : new LogicalLocation((String) t.get(3));
        Location destination = (t.get(6) instanceof Integer)? new PhysicalLocation((String) t.get(5), (Integer) t.get(6)) : new LogicalLocation((String) t.get(5));
        return new Message(type, ack, source, destination, body);
    }
View Full Code Here

Examples of org.apache.pig.penny.LogicalLocation

   
    private synchronized Tuple processRegistration(Message m) {
        // this method is synchronized to avoid concurrency problems between registering a new location and sending a message
       
        Location src = m.source();
        LogicalLocation logSrc = src.asLogical();
       
        if (!maxPhysicalIds.containsKey(logSrc)) {
            initLLState(logSrc);                    // first time we're seeing this logical location, so initialize some state for it
        }
       
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.