Package com.facebook.presto.spi

Examples of com.facebook.presto.spi.Node


                for (Node node : candidateNodes) {
                    if (!splitCountByNode.containsKey(node)) {
                        splitCountByNode.put(node, nodeTaskMap.getPartitionedSplitsOnNode(node));
                    }
                }
                Node chosenNode = null;
                int min = Integer.MAX_VALUE;

                for (Node node : candidateNodes) {
                    int assignedSplitCount = assignmentCount.containsKey(node) ? assignmentCount.get(node) : 0;
                    int totalSplitCount = assignedSplitCount + splitCountByNode.get(node);
View Full Code Here


        for (Map.Entry<Node, RemoteTask> entry : tasks1.entrySet()) {
            assertEquals(entry.getValue().getPartitionedSplitCount(), 5);
        }

        // Add new node
        Node additionalNode = new PrestoNode("other4", URI.create("http://127.0.0.1:14"), NodeVersion.UNKNOWN);
        nodeManager.addNode("foo", additionalNode);

        // Schedule next query with 5 splits. Since the new node does not have any splits, all 5 splits are assigned to the new node
        SqlStageExecution sqlStageExecution2 = createSqlStageExecution(nodeScheduler, 5, 5);
        Future future2 = sqlStageExecution2.start();
View Full Code Here

    }

    @Test
    public void testGetCurrentNode()
    {
        Node expected = activeNodes.get(0);

        NodeInfo nodeInfo = new NodeInfo(new NodeConfig()
                .setEnvironment("test")
                .setNodeId(expected.getNodeIdentifier()));

        DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion);

        assertEquals(manager.getCurrentNode(), expected);
    }
View Full Code Here

    @Test
    public void testMaxSplitsPerNode()
            throws Exception
    {
        Node newNode = new PrestoNode("other4", URI.create("http://127.0.0.1:14"), NodeVersion.UNKNOWN);
        nodeManager.addNode("foo", newNode);

        ImmutableList.Builder<Split> initialSplits = ImmutableList.builder();
        for (int i = 0; i < 10; i++) {
            initialSplits.add(new Split("foo", new TestSplitRemote()));
View Full Code Here

    @Test
    public void testMaxSplitsPerNodePerTask()
            throws Exception
    {
        Node newNode = new PrestoNode("other4", URI.create("http://127.0.0.1:14"), NodeVersion.UNKNOWN);
        nodeManager.addNode("foo", newNode);

        ImmutableList.Builder<Split> initialSplits = ImmutableList.builder();
        for (int i = 0; i < 20; i++) {
            initialSplits.add(new Split("foo", new TestSplitRemote()));
View Full Code Here

    @Test
    public void testTaskCompletion()
            throws Exception
    {
        MockRemoteTaskFactory remoteTaskFactory = new MockRemoteTaskFactory(remoteTaskExecutor);
        Node chosenNode = Iterables.get(nodeManager.getActiveDatasourceNodes("foo"), 0);
        RemoteTask remoteTask = remoteTaskFactory.createTableScanTask(chosenNode, ImmutableList.of(new Split("foo", new TestSplitRemote())));
        nodeTaskMap.addTask(chosenNode, remoteTask);
        assertEquals(nodeTaskMap.getPartitionedSplitsOnNode(chosenNode), 1);
        remoteTask.cancel();
        TimeUnit.MILLISECONDS.sleep(100); // Sleep until cache expires
View Full Code Here

                for (Node node : candidateNodes) {
                    if (!splitCountByNode.containsKey(node)) {
                        splitCountByNode.put(node, nodeTaskMap.getPartitionedSplitsOnNode(node));
                    }
                }
                Node chosenNode = null;
                int min = Integer.MAX_VALUE;

                for (Node node : candidateNodes) {
                    int assignedSplitCount = assignmentCount.containsKey(node) ? assignmentCount.get(node) : 0;
                    int totalSplitCount = assignedSplitCount + splitCountByNode.get(node);
View Full Code Here

        else if (fragment.getOutputPartitioning() == OutputPartitioning.HASH) {
            checkArgument(noMoreParentNodes, "Hash partitioned output requires all parent nodes be added in a single call");

            ImmutableMap.Builder<String, PagePartitionFunction> buffers = ImmutableMap.builder();
            for (int nodeIndex = 0; nodeIndex < parentNodes.size(); nodeIndex++) {
                Node node = parentNodes.get(nodeIndex);
                buffers.put(node.getNodeIdentifier(), new HashPagePartitionFunction(nodeIndex, parentNodes.size(), fragment.getPartitioningChannels(), fragment.getTypes()));
            }

            newOutputBuffers = startingOutputBuffers
                    .withBuffers(buffers.build())
                    .withNoMoreBufferIds();
View Full Code Here

    {
        // create tasks on "nodeCount" random nodes
        List<Node> nodes = nodeSelector.selectRandomNodes(nodeCount);
        checkCondition(!nodes.isEmpty(), NO_NODES_AVAILABLE, "No worker nodes available");
        for (int taskId = 0; taskId < nodes.size(); taskId++) {
            Node node = nodes.get(taskId);
            scheduleTask(taskId, node);
        }

        // tell sub stages about all nodes and that there will not be more nodes
        for (StageExecutionNode subStage : subStages.values()) {
View Full Code Here

    }

    private void scheduleOnCurrentNode()
    {
        // create task on current node
        Node node = nodeSelector.selectCurrentNode();
        scheduleTask(0, node);

        // tell sub stages about all nodes and that there will not be more nodes
        for (StageExecutionNode subStage : subStages.values()) {
            subStage.parentNodesAdded(ImmutableList.of(node), true);
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.Node

Copyright © 2018 www.massapicom. 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.